private function _getPaginatorPresenter(array $items)
{
if (!$this->_paginate) {
return null;
}
$params = Input::get();
if (!empty($params)) {
// There are parameters in the URL - pass them to paginator
if (isset($params['page'])) {
// We don't need that - paginator will add new one
unset($params['page']);
}
}
// Prepare paginator and pass it to presenter
$paginator = new LengthAwarePaginator($items, $this->_totalItems, $this->_perPage, $this->_page, ['path' => Request::url()]);
$paginator->appends($params);
return new $this->_paginationPresenter($paginator);
}