/**
* Add pagination
*
* @param int $limit the number of items per page
* @param array $options and optional array with options for the pagination class
* @return object a sliced set of data
*/
public function paginate($limit, $options = array())
{
if (is_a($limit, 'Pagination')) {
$this->pagination = $limit;
return $this;
}
$pagination = new Pagination($this->count(), $limit, $options);
$pages = $this->slice($pagination->offset(), $pagination->limit());
$pages->pagination = $pagination;
return $pages;
}