PHP pagination class
PHP pagination class for displaying database results in pages
Usage
Simple and raw. No theory, plain code. This is it, PHP pagination class, one of the most wanted snippets for web applications.
How to use it:
Istantiate the class (PHP5 version):
$p = new pagination();
Run the first query to select the number of total rows and call the first function,
with arguments the total rows number, how many rows to show per page and current page number:
$arr = $p->calculate_pages(70, 10, 1);
This function will call the second one in the class to get the surrounding pages of the page
we are requesting.
The returned result should look like this:
Array
(
[limit] => LIMIT 0,10
[current] => 1
[previous] => 1
[next] => 2
[last] => 7
[info] => Page (1 of 7)
[pages] => Array
(
[0] => 1
[1] => 2
[2] => 3
[3] => 4
[4] => 5
)
)
Take care.

Comments
Thanks a bunch, very useful.
Used this today. It's great Steve!