Tell me the implementation of the algorithm for displaying links to pages

In all known algorithms, a link to the current page is displayed in the middle:

[20][21][22][孝袝袣校些袗携][24][25][26] .

When you click on the adjacent links, they become again in the middle, i.e. 3 links to the left and 3 links to the right.

But how do I need:

 [20][孝袝袣校些袗携][22][23][24][25][26] [20][21][孝袝袣校些袗携][23][24][25][26] [20][21][22][孝袝袣校些袗携][24][25][26] [20][21][22][23][孝袝袣校些袗携][25][26] [20][21][22][23][24][孝袝袣校些袗携][26] 

Those. so that the current page from the range of links with an example can float between [21] and [25] . Under [孝袝袣校些袗携] enter the absence of references, for example: <b>[小孝袪袗袧袠笑袗]</b> .

And when you click on the extreme link [20] list becomes:

 [15][16][17][18][19][孝袝袣校些袗携][21] 

When you click on the extreme [26] :

 [25][孝袝袣校些袗携][27][28][29][30][31] 
  • one
    Try to first describe the algorithm itself. As soon as you describe, you can implement it yourself or request help from the community. - Ostin
  • one
    Still, I recommend starting with the narrative. Formulate in Russian how it should work. At the same time, most of the questions on the algorithm itself will disappear. - Ostin
  • one
    Updated the description - rnovak744
  • Here is what you just did - it is depicted as a picture text. Understand me correctly, I want to help you :) "When you first click on the page number, it is in the middle of the list. When you click on the next page, the list does not move until the penultimate page from the list is clicked." And so on. As soon as you describe the algorithm in words, you can immediately implement it. Just believe :) - Ostin

0