The paging algorithm of the php3 line code (for the start page and end page ). A good paging algorithm should have the following advantages: the current page number should be in the center as much as possible. if the homepage and the last page are unavailable (currently on the first or last page), do not hide these two good paging algorithms. they should have the following advantages:
The current page number should be in the middle.
If the "homepage" and "last page" are unavailable (currently on the first or last page), do not hide these two groups of text to avoid changing the link button position.
The algorithm is simple.
The following algorithms have two advantages: 1 and 3.
The code is as follows:
// $ Curr_index, current page number.
// $ Link_count, number of links.
// $ Page_count: the total number of pages of the current data.
// $ Start indicates the start page number.
// $ End: the ending page number displayed.
$ Start = max (1, $ curr_index-intval ($ link_count/2 ));
$ End = min ($ start + $ link_count-1, $ page_count );
$ Start = max (1, $ end-$ link_count + 1 );
Start = Math. max (1, curr_index-parseInt (link_count/2 ));
End = Math. min (page_count, start + link_count-1 );
Start = Math. max (1, end-link_count + 1 );
Should have the following advantages: the current page number should be in the middle. if the "homepage" and "last page" are unavailable (currently on the first or last page), do not hide these two pages...