FIX THIS!!!

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe
2025-07-29 05:41:15 +01:00
parent f268fe9e80
commit 1c3ef02c7b

View File

@@ -31,19 +31,29 @@ class SettingsServiceProvider extends ServiceProvider
// Make sure the limit is actually set, is an integer and does not exceed system limits
\App::singleton('api_limit_value', function () {
app()->singleton('api_limit_value', function () {
$limit = config('app.max_results');
$int_limit = intval(request('limit'));
if ((abs($int_limit) > 0) && ($int_limit <= config('app.max_results'))) {
$limit = abs($int_limit);
}
// \Log::error('request limit: '. request('limit'));
// \Log::error('app.max_results: '. config('app.max_results'));
//
// $int_limit = intval(request('limit'));
// \Log::error('$int_limit: '. $int_limit);
//
// if ((abs($int_limit) > 0) && ($int_limit <= config('app.max_results'))) {
// \Log::error($int_limit . ' ('.abs($int_limit).') is a valid limit over zero and does not exceed the maximum limit of ' . config('app.max_results'));
//
// $limit = abs($int_limit);
// } else {
// \Log::error($int_limit . ' is either not greater than 0 or exceeds the maximum limit of ' . config('app.max_results'). ' - fall though to the config');
// }
//
// \Log::error('$limit: '. $limit);
return $limit;
});
// Make sure the offset is actually set and is an integer
\App::singleton('api_offset_value', function () {
app()->singleton('api_offset_value', function () {
$offset = intval(request('offset'));
return $offset;
});