The paging
data not being available is either a bug, or the documentation is wrong - I'd say it's the former, as it would be kinda redundant to count the records again when the Paginator
component already did that.
Looking at the responsible code:
shows that the exception is thrown before the paging
key is set in the params
array. So until this is fixed you'll either have to modify the core, or count and calculate again on your own, something like this (may need some tweaking):
public function index()
{
try
{
$this->Paginator->paginate();
}
catch(NotFoundException $e)
{
extract($this->Paginator->settings);
$count = $this->ModelName->find('count', compact('conditions'));
$pageCount = intval(ceil($count / $limit));
$this->redirect(array('page' => $pageCount));
}
}