Prepare Record Paginator Object

@return void
171404
public function prepareRecordPaginator()
    {
        $page = $this->getRequest()->get('page', 1);
        $this->getRecordPaginator()->setPage(intval($page));
        $this->getRecordPaginator()->setItemsPerPage(50);
    }
165756
public function render()
	{
		$paginator = $this->getPaginator();
		$page = $paginator->page;
		if ($paginator->pageCount < 2) {
			$steps = array($page);
		} else {
			$arr = range(max($paginator->firstPage, $page - 3), min($paginator->lastPage, $page + 3));
			if ($this->countBlocks) {
				$quotient = ($paginator->pageCount - 1) / $this->countBlocks;
				for ($i = 0; $i <= $this->countBlocks; $i++) {
					$arr[] = round($quotient * $i) + $paginator->firstPage;
				}
			}
			sort($arr);
			$steps = array_values(array_unique($arr));
		}

		$this->template->steps = $steps;
		$this->template->paginator = $paginator;
		$this->template->isAjax = $this->isAjax;
		$this->template->handle = 'showPage!';

		$this->template->setFile($this->getTemplateFile());
		$this->template->render();
	}
1168525
public function prepare($statement, $driver_options = [])
    {
        if (!is_null($this->pagination)) {
            $pagination_query = $this->paginateQuery($statement, $this->pagination->getCurrentPageNumber(), $this->pagination->getMaxResultsPerPage());
            $count_query = $this->convertToCountQuery($statement);

            $primary_statement = parent::prepare($pagination_query, $driver_options);
            $count_statement = parent::prepare($count_query, $driver_options);

            $statement = new PdoStatement();
            $statement->setPagination($this->pagination);
            $statement->setPrimaryStatement($primary_statement);
            $statement->setCountStatement($count_statement);

            // clear pagination
            $this->pagination = null;

            return $statement;
        } else {
            return parent::prepare($statement, $driver_options);
        }
    }
1291815
protected function prepare_query() 
	{
		$this->query->where( $this->foreign_key, $this->local_model->{$this->local_key} )
			->limit( 1 );
	}
46679
public function prepareVars()
    {
        $this->vars['columns'] = $this->prepareColumnsArray();
        $this->vars['recordsKeyFrom'] = $this->recordsKeyFrom;

        $this->vars['recordsPerPage'] = $this->getConfig('recordsPerPage', false) ?: 'false';
        $this->vars['postbackHandlerName'] = $this->getConfig('postbackHandlerName', 'onSave');
        $this->vars['searching'] = $this->getConfig('searching', false);
        $this->vars['adding'] = $this->getConfig('adding', true);
        $this->vars['deleting'] = $this->getConfig('deleting', true);
        $this->vars['toolbar'] = $this->getConfig('toolbar', true);
        $this->vars['height'] = $this->getConfig('height', false) ?: 'false';
        $this->vars['dynamicHeight'] = $this->getConfig('dynamicHeight', false) ?: 'false';

        $this->vars['btnAddRowLabel'] = Lang::get($this->getConfig('btnAddRowLabel', 'backend::lang.form.insert_row'));
        $this->vars['btnAddRowBelowLabel'] = Lang::get($this->getConfig('btnAddRowBelowLabel', 'backend::lang.form.insert_row_below'));
        $this->vars['btnDeleteRowLabel'] = Lang::get($this->getConfig('btnDeleteRowLabel', 'backend::lang.form.delete_row'));

        $isClientDataSource = $this->isClientDataSource();

        $this->vars['clientDataSourceClass'] = $isClientDataSource ? 'client' : 'server';
        $this->vars['data'] = json_encode($isClientDataSource
            ? $this->dataSource->getAllRecords()
            : []
        );
    }
59742
private function bootPaginator()
    {
        Paginator::currentPathResolver(function () {
            return url();
        });

        Paginator::currentPageResolver(function ($pageName = 'page') {
            return request()->input($pageName);
        });
    }
393296
public function prepare()
    {
        if (!$this->csv) {
            $this->csv = Writer::createFromFileObject(new SplFileObject($this->filename, 'w'));
            $this->csv->setDelimiter($this->delimiter);
            $this->csv->setEnclosure($this->enclosure);
        }

        if ($this->header !== null) {
            $this->writeItem($this->header);
        }
    }
67994
protected function prepare()
    {
        /** @var CollectionView $collection */
        $collection = $this->getComponent('collection_view');
        $collection->setData($this->getDataProvider());
        if ($collection->getDataInjector() === null) {
            $collection->setDataInjector($this->makeDataInjector());
        }
        $this->applyOperations();
        $this->hideSubmitButtonIfNotUsed();
    }
233847
protected function prepareBlockData()
    {
        $order = $this->_checkoutSession->getLastRealOrder();

        $this->addData(
            [
                'can_view_order'  => $this->canViewOrder($order),
                'view_order_url' => $this->getUrl(
                    'sales/order/view/',
                    ['order_id' => $order->getEntityId()]
                ),
                'print_url' => $this->getUrl(
                    'sales/order/print',
                    ['order_id' => $order->getEntityId()]
                )
            ]
        );
    }
656087
protected function processRecord(Record $record)
    {

        foreach ($this->processors as $processor) {
            if ($this->isInstanceOf($processor, ProcessorInterface::class)) {
                $processor->processRecord($record);
            } else {
                call_user_func($processor, $record);
            }
        }
    }
1090198
public function index() {
        $this->paginate = array_merge(array(
            'limit' => 25,
            'order' => array('ItemReport.' . $this->Model->displayField => 'ASC'),
            'contain' => array_keys($this->Model->belongsTo),
            'conditions' => array('ItemReport.status' => ItemReport::PENDING)
        ), $this->Model->admin['paginate']);

        $this->AdminToolbar->setBelongsToData($this->Model);

        $this->request->data['ItemReport']['status'] = ItemReport::PENDING;

        // Filters
        if (!empty($this->request->params['named'])) {
            $this->paginate['conditions'] = $this->AdminToolbar->parseFilterConditions($this->Model, $this->request->params['named']);
        }

        $this->set('results', $this->paginate($this->Model));
    }
39356
public function index()
    {
        $pagination = new Pagination();
        $pattern = StaticFilter::filter(
            'text',
            $this->getController()->request->getQuery('pattern', null)
        );
        $this->view = 'scaffold/index';
        $descriptor =  $this->getDescriptor();

        /** @var Select $query */
        $query = call_user_func_array([$this->getModelName(), 'find'], []);
        $field = $descriptor->getDisplayField();
        $tableName = $descriptor->getDescriptor()->getEntity()->getTableName();
        $query->where(
            [
                "{$tableName}.{$field} LIKE :pattern" => [
                    ':pattern' => "%{$pattern}%"
                ]
            ]
        );
        $pagination->setTotal($query->count());
        $query->limit(
            $pagination->rowsPerPage,
            $pagination->offset
        );
        $records = $query->all();
        $this->set(compact('pagination', 'records', 'pattern', 'descriptor'));
    }
1311503
protected function prepareVars()
    {
        $this->vars['reorderRecords'] = $this->getRecords();
        $this->vars['reorderModel'] = $this->model;
        $this->vars['reorderSortMode'] = $this->sortMode;
        $this->vars['reorderShowTree'] = $this->showTree;
        $this->vars['reorderToolbarWidget'] = $this->toolbarWidget;
    }
885642
public function initPagination($rows) {
		if ($rows instanceof Paginator) {
			$this->setPagination($rows->appends(Request::all()));
		}
	}
523240
protected function pages_prepare_next(){
		if($this->page_next<=$this->pages_count){
			$url=$this->generateurl($this->page_next);
			$this->pages[]=(object)array(
				'name'=>'&gt;',
				'url'=>$url,
				'active'=>($this->page_next==$this->page_active),
				'disabled'=>false
				);
			}else{
			$this->pages[]=(object)array(
				'name'=>'&gt;',
				'url'=>'',
				'active'=>false,
				'disabled'=>true
				);
			}
		}
857511
private function _prepare()
	{
		if (count($this->_aSelect) > 0 && $this->_aSelect[0] === 'FOUND_ROWS()' && $this->_sFrom === '') {

			$sQuery = 'SELECT FOUND_ROWS()';
		}
		else if (count($this->_aSelect) > 0 && $this->_sFrom !== '') {

			$sQuery = 'SELECT '.implode(',', $this->_aSelect).' FROM `'.$this->_sFrom.'` ';
			$sQuery = str_replace('SQL_CALC_FOUND_ROWS,', 'SQL_CALC_FOUND_ROWS ', $sQuery);

			if ($this->_sFromAs !== null) {

				$sQuery .= 'AS '.$this->_sFromAs.' ';
			}
			else {

				$sQuery .= 'AS t'.$this->_iAlias.' ';
				$this->_sFromAs = 't'.$this->_iAlias;
				$this->_iAlias++;
			}

			$sQuery .= $this->_prepareJoin();
			$sQuery .= $this->_prepareWhere();
			$sQuery .= $this->_prepareGroupBy();
			$sQuery .= $this->_prepareHaving();
			$sQuery .= $this->_prepareOrderBy();
			$sQuery .= $this->_prepareLimit();
		}
		else if ($this->_sUpdate !== '') {

			$sQuery = 'UPDATE `'.$this->_sUpdate.'` ';

			if (count($this->_aSet) > 0) {

				$sQuery .= ' SET ';

				foreach ($this->_aSet as $sKey => $sValue) {

					if ($sValue !== null) {

						$sQuery .= "`".$sKey."` = ".self::connect()->quote($sValue).",";
					}
				}
			}

			$sQuery = substr($sQuery, 0, -1);

			$sQuery .= $this->_prepareWhere();
		}
		else if ($this->_sInsertInto !== '') {

			$sQuery = 'INSERT INTO `'.$this->_sInsertInto.'` (';

			foreach ($this->_aValues as $sKey => $sValue) {

			    if (!is_array($sValue)) { $sQuery .= " `".$sKey."`,"; }
			}

			$sQuery = substr($sQuery, 0, -1);
			$sQuery .= ") VALUES (";

			foreach ($this->_aValues as $sKey => $sValue) {

				if (!is_array($sValue)) { $sQuery .= "".self::connect()->quote($sValue).","; }
			}

			$sQuery = substr($sQuery, 0, -1);
			$sQuery .= ")";
			
			if (count($this->_aOnDuplicateKeyUpdate) > 0) {
			    
			    $sQuery .= " ON DUPLICATE KEY UPDATE ";
			    
    			foreach ($this->_aOnDuplicateKeyUpdate as $sKey => $sValue) {
    			    
    			    $sQuery .= " ".$sKey." = ".self::connect()->quote($sValue).",";
    			}
    			
    			$sQuery = substr($sQuery, 0, -1);
			}
		}
		else if ($this->_sDelete !== '') {

			$sQuery = 'DELETE FROM `'.$this->_sDelete.'`';
			$sQuery .= $this->_prepareWhere();
		}
		else if ($this->_sTruncate !== '') {

			$sQuery = 'TRUNCATE `'.$this->_sTruncate.'`';
		}

		return $sQuery;
	}
1310886
public function paginate()
    {
        $this->total = $this->dataSource->getTotal($this->source);

        if (
            ($this->getPagesCount() > 0 && $this->getPage() > $this->getPagesCount()) ||
            $this->getPage() <= 0
        ) {
            $this->handler->wrongPageCallback();
        }

        $this->data = $this->dataSource->applyLimit(
            $this->source,
            $this->getPage(),
            $this->getPageSize()
        );

        return $this->data;
    }