Now I generate links to the menu pages with this code:
for ($i = 0; $i < $num_of_pages; $i++) { $actual = $i + 1; if($i === intval($page)){ echo "<a id=\"now\" href=\"http://site.com/index.php?page=".$i."\">".$actual."</a> "; } else { echo "<a id=\"other\" href=\"http://site.com/index.php?page=".$i."\">".$actual."</a> "; } } And it displays the total number of pages in the menu. How can I make a restriction, so that each side of the actual page displays 2 previous / next, and instead of the remaining dots. Assume:
1 2 3 ...
1 2 3 4 ...
1 2 3 4 5 ...
... 2 3 4 5 6 ...
While ideas on how to track it correctly, did not come.