src/EntityQueryBuilder.php
public function paginate($page = 1, $itemsPerPage = 10)
    {
        if (!is_int($page) || !is_int($itemsPerPage)) {
            throw new Exception\InvalidArgumentException(
                sprintf(
                    'Incorrect argument %s. Only number allowed.', is_int($page) ? '$itemsPerPage' : '$page'
                )
            );
        }

        if ($page < 1) {
            throw new Exception\InvalidArgumentException(
                sprintf('Incorrect page number: %d. Only positive number allowed.', $page)
            );
        }

        if ($itemsPerPage < 1) {
            throw new Exception\InvalidArgumentException(
                sprintf('Incorrect items per page: %d. Only positive number allowed.', $page)
            );
        }

        return $this->limit($itemsPerPage, ($page - 1) * $itemsPerPage);
    }
public function paginate($page = 1, $itemsPerPage = 10)
    {
        if (!is_int($page) || !is_int($itemsPerPage)) {
            throw new Exception\InvalidArgumentException(
                sprintf(
                    'Incorrect argument %s. Only number allowed.', is_int($page) ? '$itemsPerPage' : '$page'
                )
            );
        }

        if ($page < 1) {
            throw new Exception\InvalidArgumentException(
                sprintf('Incorrect page number: %d. Only positive number allowed.', $page)
            );
        }

        if ($itemsPerPage < 1) {
            throw new Exception\InvalidArgumentException(
                sprintf('Incorrect items per page: %d. Only positive number allowed.', $page)
            );
        }

        return $this->limit($itemsPerPage, ($page - 1) * $itemsPerPage);
    }
Limit results with selected page.

@param int $page
@param int $itemsPerPage

@return $this This QueryBuilder instance.
@throws \Xloit\Bridge\Doctrine\ORM\Exception\InvalidArgumentException