Returns an array of objects

@param integer $page    The page to return
@param integer $perPage The number of items to return per page
@param array   $data    An array of data to pass to getCountCommonBuckets()

@return array
970110
public function getObjects($page = null, $perPage = null, $data = [])
    {
        $oDb = Factory::service('Database');
        $oDb->select('o.id, o.filename, o.filename_display, o.serves, o.downloads, o.thumbs, o.scales, o.driver, o.md5_hash');
        $oDb->Select('o.created, o.created_by, o.modified, o.modified_by');
        $oDb->select('o.mime, o.filesize, o.img_width, o.img_height, o.img_orientation, o.is_animated');
        $oDb->select('b.id bucket_id, b.label bucket_label, b.slug bucket_slug');

        $oDb->join(NAILS_DB_PREFIX . 'cdn_bucket b', 'b.id = o.bucket_id', 'LEFT');

        // --------------------------------------------------------------------------

        //  Apply common items; pass $data
        $this->getCountCommonObjects($data);

        // --------------------------------------------------------------------------

        //  Facilitate pagination
        if (!is_null($page)) {

            /**
             * Adjust the page variable, reduce by one so that the offset is calculated
             * correctly. Make sure we don't go into negative numbers
             */

            $page--;
            $page = $page < 0 ? 0 : $page;

            //  Work out what the offset should be
            $perPage = is_null($perPage) ? 50 : (int) $perPage;
            $offset  = $page * $perPage;

            $oDb->limit($perPage, $offset);
        }

        // --------------------------------------------------------------------------

        $objects    = $oDb->get(NAILS_DB_PREFIX . 'cdn_object o')->result();
        $numObjects = count($objects);

        for ($i = 0; $i < $numObjects; $i++) {
            $this->formatObject($objects[$i]);
        }

        return $objects;
    }
783188
public function determineChildrenPagination($perPage, HasMany $children)
    {
        if ($perPage === false)
        {
            return $children;
        }

        return is_null($perPage) ?
            $children->get() :
            $children->paginate($perPage);
    }
1072895
public function forPage($page, $perPage = 15)
	{
		if( $page < 1 )
		{
			$page = 1;
		}
		return $this->limit($perPage, ($page - 1) * $perPage);
	}
882149
public function paginate($page = 1, $maxPerPage = 10)
    {
        $this
            ->setLimit($maxPerPage)
            ->setOffset(($page - 1) * $maxPerPage);

        $pager = $this->find();
        $pager->setPage($page);
        $pager->setMaxPerPage($maxPerPage);

        return $pager;
    }
1008383
public function page ($page, $per_page = null)
	{
		$model = $this->model;

		if($per_page === null) { $per_page = $model::$per_page; }

		$this->offset($page * $per_page)->limit($per_page);

		return $this;
	}
78756
public function orders($page = 1, $perPage = 30, $saleSystem = null, array $statuses = [])
    {
        $filters = [];

        if (!is_null($saleSystem)) {
            $filters['sale_system'] = (string) $saleSystem;
        }

        if (!is_null($statuses)) {
            $filters['statuses'] = (array) $statuses;
        }

        $query = [
            'page'     => (int)   $page,
            'per_page' => (int)   $perPage,
            'filters'  => (array) $filters,
        ];

        /** @var \SkyHub\Api\Handler\Response\HandlerInterface $responseHandler */
        $responseHandler = $this->service()->get($this->baseUrlPath(null, $query));
        return $responseHandler;
    }
1068930
public function getBucketsFlat($page = null, $perPage = null, $data = [])
    {
        $aBuckets = $this->getBuckets($page, $perPage, $data);
        $aOut     = [];

        foreach ($aBuckets as $oBucket) {
            $aOut[$oBucket->id] = $oBucket->label;
        }

        return $aOut;
    }
86768
public function paginate($per_page = 5, $page = null, $page_name = 'imap_page'){
        $this->page = $page > $this->page ? $page : $this->page;
        $this->limit = $per_page;

        return $this->get()->paginate($per_page, $this->page, $page_name);
    }
149224
protected function getProjectList($page = 1, $perPage= 100)
    {
        $listRaw = $this->client->projects->accessible($page, $perPage);
        $list = [];
        foreach ($listRaw as $item) {
            if (array_get($item, 'namespace.name') === $this->namespace) {
                $list[] = $item;
            }
        }

        return $list;
    }
742486
protected function chunk($translations, $page = 1, $perPage = 20)
    {
        if (!$count = count($translations)) {
            return [];
        }

        $pages = array_chunk($translations, $perPage, true);

        $min = 1;
        $max = ceil($count / $perPage);

        if ($page < $min || $page > $max) {
            $page = 1;
        }

        return $pages[$page - 1];
    }
712729
public function paginate($perPage = null, $columns = ['*'], $pageName = 'page', $page = null)
    {
        $page = $page ?: Paginator::resolveCurrentPage($pageName);

        $perPage = $perPage ?: $this->model->getPerPage();

        $results = ($total = $this->toBase()->getCountForPagination())
                                    ? $this->forPage($page, $perPage)->get($columns)
                                    : $this->model->newCollection();

        return $this->paginator($results, $total, $perPage, $page, [
            'path' => Paginator::resolveCurrentPath(),
            'pageName' => $pageName,
        ]);
    }
800969
public function paginate(Builder $builder, $perPage, $page)
    {
        $builder->limit = $perPage;
        $builder->offset = ($perPage * $page) - $perPage;

        return $this->search($builder);
    }
657133
protected function paginate($items, $perPage = 15)
    {
        $currentPage = LengthAwarePaginator::resolveCurrentPage();

        $currentPageItems = collect($items)->slice(($currentPage - 1) * $perPage, $perPage);

        return new LengthAwarePaginator($currentPageItems, count($items), $perPage);
    }
280250
public function paginate($perPage = null, $pageName = 'page', $page = null)
    {
        $engine = $this->engine();

        $page = $page ?: Paginator::resolveCurrentPage($pageName);

        $perPage = $perPage ?: $this->model->getPerPage();

        $results = $this->model->newCollection($engine->map(
            $this, $rawResults = $engine->paginate($this, $perPage, $page), $this->model
        )->all());

        $paginator = (new LengthAwarePaginator($results, $engine->getTotalCount($rawResults), $perPage, $page, [
            'path' => Paginator::resolveCurrentPath(),
            'pageName' => $pageName,
        ]));

        return $paginator->appends('query', $this->query);
    }
1325919
public function paginate($page, $perPage = null)
    {
        $page = (int)$page;
        if ($page < 1) {
            $page = 1;
        }
        
        if ($perPage === null) {
            if (!$perPage = $this->select->getRawState('limit')) {
                throw new Exception\InvalidArgumentException(
                    "No per page passed and no limit is set"
                );
            }
        }
        
        $modelClass = $this->modelClass;
        $paginator  = new Paginator($this->select, $modelClass::adapter());
        $items      = $paginator->getItems(($page - 1) * $perPage, $perPage);
        $collection = $this->buildCollection($items->toArray());
        
        $collection->setPage($page);
        $collection->setPerPage($perPage);
        $collection->setPaginator($paginator);
        
        return $collection;
    }
1340833
public function all($related = [], $perPage = 0)
    {
        $results = $this->model->with($related)->orderBy('created_at', 'DESC');
        return $perPage ? $results->paginate($perPage) : $results->get();
    }
620482
public function paginate($page, $perPage = 30)
	{
		$this->set('from', max(0, $perPage * ($page - 1)));
		$this->set('size', $perPage);

		return $this;
	}