Permalink
Browse files

avoid paginate count when no results

  • Loading branch information...
ceeram committed Jan 10, 2013
1 parent 7008b81 commit 88240b28748ecb96d5ecf63fa84dc7432461ad8d
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/Cake/Controller/Component/PaginatorComponent.php
@@ -197,7 +197,9 @@ public function paginate($object = null, $scope = array(), $whitelist = array())
$defaults = $this->getDefaults($object->alias);
unset($defaults[0]);
if ($object->hasMethod('paginateCount')) {
if (!$results) {
$count = 0;
} elseif ($object->hasMethod('paginateCount')) {
$count = $object->paginateCount($conditions, $recursive, $extra);
} else {
$parameters = compact('conditions');

0 comments on commit 88240b2

Please sign in to comment.