Cake\Controller\Component\PaginatorComponent::checkLimit PHP Method

checkLimit() public method

Check the limit parameter and ensure it's within the maxLimit bounds.
public checkLimit ( array $options ) : array
$options array An array of options with a limit key to be checked.
return array An array of options for pagination
    public function checkLimit(array $options)
    {
        $options['limit'] = (int) $options['limit'];
        if (empty($options['limit']) || $options['limit'] < 1) {
            $options['limit'] = 1;
        }
        $options['limit'] = max(min($options['limit'], $options['maxLimit']), 1);
        return $options;
    }