mako-framework/framework — pull request #93 by aldoanizio (2014-04-28 06:30:24+00:00)
Title: Added new pagination methods

Added some extra functions to pagination:

// Returns the total amount of items.
$totalItems = $pagination->total();

// Returns the number of the first item on the paginator
$from = $pagination->from();

// Returns the number of the last item on the paginator
$to = $pagination->to();

// So it's possible to show show pagination information at pagination template using "preserve"
echo "Showing {{preserve:$from}} to {{preserve:$to}} of {{preserve:$total}} records";

PS.: I've named the "total" method instead "count" because in pagination render the preserve variable "count" was already taken by the number of pages.

PS².: I've also put a little "fix" in constructor method to avoid current page be higher than total of pages