Create Paginator.php

In Controller: $paginator = Paginator::paginate($results, $page, 10);
where $results are array, $page is current page, and 10 is results per page.
In view script you could use it like:

echo "<a href='$paginator->prev'>&lt;&lt; Previous</a> ";
echo " <a href='$paginator->next'>Next &gt;&gt;</a> ";
echo "<br />Page " . $paginator->currentPage . " out of a " . $paginator->lastPage;