Defines the limit for the Propel query.

@param Request $request the current request
@return int the propel query limit
422975
protected function getLimit(Request $request)
    {
        return min(
            $this->getMaxLimit($request),
            $request->query->get(
                'length',
                $this->getDefaultLimit($request)
            )
        );
    }
932542
protected function secondsRemainingOnLockout( Request $request )
	{
		return UniversalBuilder::resolveClass( RateLimiter::class )->availableIn( $this->getThrottleKey( $request ) );
	}
812771
public function getPage(Request $request)
    {
        $parameters = $this->fixParameters($request->query->all());

        $transUnits = $this->storage->getTransUnitList(
            $this->localeManager->getLocales(),
            $request->query->get('rows', 20),
            $request->query->get('page', 1),
            $parameters
        );

        $count = $this->storage->countTransUnits($this->localeManager->getLocales(), $parameters);

        return array($transUnits, $count);
    }
979068
protected function hasTooManyLoginAttempts(Request $request)
    {
        return $this->limiter()->tooManyAttempts(
            $this->throttleKey($request), $this->maxAttempts()
        );
    }
435381
protected function hasTooManyLoginAttempts( Request $request )
	{
		return UniversalBuilder::resolveClass( RateLimiter::class )->tooManyAttempts( $this->getThrottleKey( $request ), $this->maxLoginAttempts(), $this->lockoutTime() / 60 );
	}
753976
private function waitForLock(Request $request): bool
    {
        $wait = 0;
        while ($this->store->isLocked($request) && $wait < 100) {
            usleep(50000);
            ++$wait;
        }

        return $wait < 100;
    }
12677
public function bindRequest(Request $request)
    {
        $query = $request->query;
        $session = $request->getSession();

        $adminListName = 'listconfig_' . $request->get('_route');

        $this->page = $request->query->getInt('page', 1);
        $this->limit = $request->query->getInt('limit', $this->getLimitOptions()[0]);

        $adminListSessionData = $request->getSession()->get($adminListName);
        if (!$query->has('limit') && null !== $adminListSessionData && isset($adminListSessionData['limit'])) {
            $this->limit = $adminListSessionData['limit'];
        }

        if ($request->query->has('limit') && !$request->query->has('page')) {
            $this->page = 1;
        }

        // Allow alphanumeric, _ & . in order by parameter!
        $this->orderBy = preg_replace('/[^[a-zA-Z0-9\_\.]]/', '', $request->query->get('orderBy', ''));
        $this->orderDirection = $request->query->getAlpha('orderDirection', '');

        // there is a session and the filter param is not set
        if ($session->has($adminListName) && !$query->has('filter')) {
            if (!$query->has('page') && !$query->has('limit')) {
                $this->page = $adminListSessionData['page'];
            }

            if (!$query->has('orderBy')) {
                $this->orderBy = $adminListSessionData['orderBy'];
            }

            if (!$query->has('orderDirection')) {
                $this->orderDirection = $adminListSessionData['orderDirection'];
            }
        }

        // save current parameters
        $session->set(
            $adminListName,
            [
                'page' => $this->page,
                'limit' => $this->limit,
                'orderBy' => $this->orderBy,
                'orderDirection' => $this->orderDirection,
            ]
        );

        // Remove limit from query param so it doesn't affect the session of the filter builder
        $request->query->remove('limit');
        $this->getFilterBuilder()->bindRequest($request);
    }
728589
protected function paginate(Request $request)
    {
        return $this->jobs->getFailed($request->query('starting_at') ?: -1)->map(function ($job) {
            return $this->decode($job);
        });
    }
1268296
public function index(Request $request)
    {
        $limit = 20;
        $prev = null;
        $user = $request->user();

        $this->validate($request, [
            'since'     => 'iso8601',
            'until'     => 'iso8601',
            'cursor'    => 'uuid',
            'tag_id'    => 'uuid',
            'source_id' => 'uuid',
            ]);

        $dids = $user->dids()
            ->fullTextSearchFilter($request->q, $user->id)
            ->tagFilter($request->tag_id)
            ->sourceFilter($request->source_id)
            ->cursorFilter($request->cursor)
            ->dateFilter($request->since, $request->until)
            ->with(['tags', 'source'])
            ->orderBy(DB::raw('uuid_v1_timestamp(id)'), 'DESC')
            ->limit($limit)->get();

        // if the cursor is being passed in then we need to obtain the previous id.
        if(!empty($request->cursor)){
            $dids_prev = $user->dids()
                ->fullTextSearchFilter($request->q, $user->id)
                ->tagFilter($request->tag_id)
                ->sourceFilter($request->source_id)
                ->prevFilter($request->cursor)
                ->dateFilter($request->since, $request->until)
                ->orderBy(DB::raw('uuid_v1_timestamp(id)'), 'ASC')
                ->limit($limit)->get();

            if($dids_prev->count() == $limit) $prev = $dids_prev->last()->id;
        }

        $results = fractal()
            ->collection($dids, new DidTransformer())
            ->withCursor(new Cursor($request->cursor, $prev, $dids, $limit));

        return response()->json($results);
    }
688048
protected function hasTooManyLoginAttempts(Request $request)
    {
        return $this->limiter()->tooManyAttempts(
            $this->throttleKey($request), $this->maxLoginAttempts, $this->lockoutTime
        );
    }
438621
protected function getOffset(Request $request)
    {
        return max(
            $request->query->get('start', 0),
            $this->getDefaultOffset($request)
        );
    }
1096981
public function index(Request $request)
    {
        $keyword = $request->get('search');
        $perPage = 25;

        if (!empty($keyword)) {
            $settings = Setting::where('key', 'LIKE', "%$keyword%")
                ->orWhere('value', 'LIKE', "%$keyword%")
                ->orderBy('key')->paginate($perPage);
        } else {
            $settings = Setting::orderBy('key')->paginate($perPage);
        }

        return view('admin.settings.index', compact('settings'));
    }
488755
public function processLimit(Request $request, $processor)
    {
        if ( ! is_null($limit = $this->limitObtainer->get($request)) and
            $processor instanceof Limit\ProcessStrategy) {

            return $processor->limit(
                $this->limitParser->parse($limit)
            );
        }
    }
1335699
public function checkRequestLimit()
  {
    $isLimitReached = false;
    $client     = $this->getClient();
    
    if ( ! is_null($client)) {
      $currentTotalRequest = 1;
      $currentTime     = time();
      $requestLimitUntil   = $currentTime;
      
      $requestLimitUntil = strtotime($client->request_limit_until);
      if ($requestLimitUntil < 0) {
        $requestLimitUntil = $currentTime;
      }

      if ($currentTime <= $requestLimitUntil) {
        $currentTotalRequest = $client->current_total_request + 1;

        if ($currentTotalRequest > $client->request_limit) {
          $isLimitReached = true;
        }
      }

      if ($currentTime > $requestLimitUntil) {
        $dateTime = new DateTime('+1 hour');

        $requestLimitUntil = $dateTime->getTimestamp();

        unset($dateTime);
      }

      if ( ! $isLimitReached) {
        $dateTime = new DateTime();

        $client->current_total_request = $currentTotalRequest;
        $client->request_limit_until   = $dateTime->setTimestamp($requestLimitUntil)->format('Y-m-d H:i:s');
        $client->last_request_at     = $dateTime->setTimestamp($currentTime)->format('Y-m-d H:i:s');

        $client->save();

        unset($dateTime);
      }
    }

    unset($client);

    return $isLimitReached;
  }
1133387
static function limit ( $request, $columns )
	{
		$limit = '';

		if ( isset($request['start']) && $request['length'] != -1 ) {
			$limit = "LIMIT ".intval($request['start']).", ".intval($request['length']);
		}

		return $limit;
	}
560005
protected function search(Request $request)
    {
        $allResults = $this->repository->search($request->all());
        return Response::apiResponse([
            'data' => $allResults
        ]);
    }
1129265
protected function resolveMaxAttempts($request, $maxAttempts)
    {
        if (Str::contains($maxAttempts, '|')) {
            $maxAttempts = explode('|', $maxAttempts, 2)[$request->user() ? 1 : 0];
        }

        if (! is_numeric($maxAttempts) && $request->user()) {
            $maxAttempts = $request->user()->{$maxAttempts};
        }

        return (int) $maxAttempts;
    }