Content/ArticleDataProvider.php
private function addPagination(Search $search, $pageSize, $page, $limit)
    {
        $offset = 0;
        if ($pageSize) {
            $pageSize = intval($pageSize);
            $offset = ($page - 1) * $pageSize;
        }

        if (null === $limit) {
            $limit = $this->defaultLimit;
        }

        if (null === $pageSize || $offset + $pageSize > $limit) {
            $pageSize = $limit - $offset;

            if ($pageSize < 0) {
                $pageSize = 0;
            }
        }

        $search->setFrom($offset);
        $search->setSize($pageSize);
    }
private function addPagination(Search $search, $pageSize, $page, $limit)
    {
        $offset = 0;
        if ($pageSize) {
            $pageSize = intval($pageSize);
            $offset = ($page - 1) * $pageSize;
        }

        if (null === $limit) {
            $limit = $this->defaultLimit;
        }

        if (null === $pageSize || $offset + $pageSize > $limit) {
            $pageSize = $limit - $offset;

            if ($pageSize < 0) {
                $pageSize = 0;
            }
        }

        $search->setFrom($offset);
        $search->setSize($pageSize);
    }
private function addPagination ( Search $ search , $ pageSize , $ page , $ limit ) { $ offset = 0 ; if ( $ pageSize ) { $ pageSize = intval ( $ pageSize ) ; $ offset = ( $ page - 1 ) * $ pageSize ; } if ( null === $ limit ) { $ limit = $ this -> defaultLimit ; } if ( null === $ pageSize || $ offset + $ pageSize > $ limit ) { $ pageSize = $ limit - $ offset ; if ( $ pageSize < 0 ) { $ pageSize = 0 ; } } $ search -> setFrom ( $ offset ) ; $ search -> setSize ( $ pageSize ) ; }
Add the pagination to given query.

@param Search $search
@param int $pageSize
@param int $page
@param int $limit
Add the pagination to given query .