Currently I have this loop that generates the page numbers but it generates all the numbers of pages in one big long list.
for($i = 1; $i <= $total_pages; $i++){
if(($current_page) == $i){
// You are on this page
echo "[<b>"."$i"."</b>] ";
} else {
// Display other page numbers
echo "<a href=\"".$_SERVER['PHP_SELF']."?page=$i\">$i </a>";
}
}
This gives me an output of [1] 2 3 4 5 6 7 8 9 10 .. ect ect.. how ever many pages are needed to display all the entries in the database. Where the bold number is the current page you are on.
I would like it so that it only displays 5 page numbers at a time. When the user clicks on page 5 for example it would display the page numbers like this.
3 4 [5] 6 7
2 page numbers on either side of the current page you are on.