enhancement to paginator

As pointed out, we need to make sure that we are also on the first page
to make this conditional clause valid
This commit is contained in:
Toby Cox 2014-04-17 10:03:08 +01:00 committed by mark_story
parent 296ea215b1
commit 823f01601d

View file

@ -202,8 +202,8 @@ class PaginatorComponent extends Component {
$count = 0; $count = 0;
} elseif ($object->hasMethod('paginateCount')) { } elseif ($object->hasMethod('paginateCount')) {
$count = $object->paginateCount($conditions, $recursive, $extra); $count = $object->paginateCount($conditions, $recursive, $extra);
} elseif (count($results)<$limit) { } elseif (count($results) < $limit && $page==1) {
$count = count($results); // no point in finding the count if it's less than our limit $count = count($results); // no point in finding the count if it's less than our limit and we're on the first page
} else { } else {
$parameters = compact('conditions'); $parameters = compact('conditions');
if ($recursive != $object->recursive) { if ($recursive != $object->recursive) {