Returns an array of buckets

@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
337840
public function getBuckets($page = null, $perPage = null, $data = [])
    {
        $oDb = Factory::service('Database');
        $oDb->select('b.id,b.slug,b.label,b.allowed_types,b.max_size,b.created,b.created_by');
        $oDb->select('b.modified,b.modified_by');

        //  Apply common items; pass $data
        $this->getCountCommonBuckets($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);
        }

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

        $buckets    = $oDb->get(NAILS_DB_PREFIX . 'cdn_bucket b')->result();
        $numBuckets = count($buckets);

        for ($i = 0; $i < $numBuckets; $i++) {

            //  Format the object, make it pretty
            $this->formatBucket($buckets[$i]);
        }

        return $buckets;
    }
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);
    }
776159
public function getAll($identity, $page = 1, $perPage = 25)
    {
        $params = array(
            'page' => $page,
            'per_page' => $perPage
        );

        return $this->_user->get('account/identity/' . $identity . '/token', $params);
    }
753286
public function forPage($page, $perPage)
    {
        $offset = max(0, ($page - 1) * $perPage);

        return $this->slice($offset, $perPage);
    }
217536
protected function groupedPaginate($paginator, $perPage, $columns)
	{
		$results = $this->get($columns);

		return $this->buildRawPaginator($paginator, $results, $perPage);
	}
616799
public function paginate($perPage = 30)
    {
        $page      = request()->input('page', 1);
        $items     = $this->slice(($page * $perPage) - $perPage, $perPage, true);
        $paginator = new LengthAwarePaginator($items, $this->count(), $perPage, $page);

        $paginator->setPath(request()->url());

        return $paginator;
    }
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;
    }
532630
public function forPage(int $page, int $perPage): CollectionInterface
    {
        $page--;
        $offset = $page * $perPage;

        return $this->slice($offset, $perPage);
    }
553680
public function getObjectsForUser($userId, $page = null, $perPage = null, $data = [])
    {
        $oDb = Factory::service('Database');
        $oDb->where('o.created_by', $userId);
        return $this->getObjects($page, $perPage, $data);
    }
34601
public function pagination($perPage = 15)
    {

        $currentPageFinder = Paginator::getCurrentPageFinder();
        $pathFinder = Paginator::getRequestPathFinder();


        $pagination = new Paginator($perPage, call_user_func($currentPageFinder), [
            'pageName' => 'page',
            'path' => call_user_func($pathFinder),
        ]);

        $pagination->setMode(Paginator::MODE_STANDART);
        $count = $this->build()->rowCount();

        $pagination->count($count);

        return $pagination;
    }
24483
public function paginate($perPage = 15)
    {
        $paginator = Paginator::make($this->items, count($this->items), $perPage);

        $start = ($paginator->getFactory()->getCurrentPage() - 1) * $perPage;
        $sliced = array_slice($this->items, $start, $perPage);

        return Paginator::make($sliced, count($this->items), $perPage);
    }
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;
    }
972724
public function getUsers($perPage = 15)
    {
        $directory = Google::make('directory');
        try {
            $r = $directory->users->listUsers([
                'domain' => config('users.google_apps_domain'),
                'maxResults' => $perPage
            ]);
        } catch (\Exception $e) {
            return json_decode($e->getMessage());
        }

        return $r->users;
    }
1030790
public function simplePagination($perPage = 15){
        $pegination = $this->pagination($perPage);

        $pegination->setMode(Paginator::MODE_SIMPLE);
        return $pegination;
    }
977971
public function getLogs($page = 1, $perPage = 20)
    {
        return $this->getUser()->post(
            'source/log',
            array('id' => $this->getId(), 'page' => $page, 'per_page' => $perPage)
        );
    }
642418
public function forPage(int $page, int $perPage)
    {
        return $this->slice(($page - 1) * $perPage, $perPage);
    }
601439
public function repoAll($page = 1, $perPage = 50)
    {
        $repo = $this->client->api('Repositories');
        $pager = new Pager($repo->getClient(), $repo->all($this->username));
        /** @var \Buzz\Message\Response $response */
        $response = $this->checkResponse($pager->fetchAll());

        return json_decode($response->getContent(), true)['values'];
    }