diff --git a/app/Http/Controllers/Api/ReportsController.php b/app/Http/Controllers/Api/ReportsController.php index 7ac704e2f2..f42a2d0f81 100644 --- a/app/Http/Controllers/Api/ReportsController.php +++ b/app/Http/Controllers/Api/ReportsController.php @@ -57,8 +57,12 @@ class ReportsController extends Controller $sort = in_array($request->input('sort'), $allowed_columns) ? e($request->input('sort')) : 'created_at'; $order = ($request->input('order') == 'asc') ? 'asc' : 'desc'; $offset = request('offset', 0); - $limit = request('limit', 50); $total = $actionlogs->count(); + + // Check to make sure the limit is not higher than the max allowed + ((config('app.max_results') >= $request->input('limit')) && ($request->filled('limit'))) ? $limit = $request->input('limit') : $limit = config('app.max_results'); + + $actionlogs = $actionlogs->orderBy($sort, $order)->skip($offset)->take($limit)->get(); return response()->json((new ActionlogsTransformer)->transformActionlogs($actionlogs, $total), 200, ['Content-Type' => 'application/json;charset=utf8'], JSON_UNESCAPED_UNICODE); diff --git a/package-lock.json b/package-lock.json index b03e7eb62c..711ca8f2d7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2033,9 +2033,9 @@ } }, "acorn": { - "version": "8.8.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.0.tgz", - "integrity": "sha512-QOxyigPVrpZ2GXT+PFyZTl6TtOFc5egxHIP9IlQ+RbupQuX4RkT/Bee4/kQuC02Xkzg84JcT7oLYtDIQxp+v7w==" + "version": "8.8.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz", + "integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==" }, "acorn-import-assertions": { "version": "1.8.0", diff --git a/package.json b/package.json index 27f1b698a9..f64399454f 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ }, "dependencies": { "@fortawesome/fontawesome-free": "^6.2.1", - "acorn": "^8.8.0", + "acorn": "^8.8.2", "acorn-import-assertions": "^1.8.0", "admin-lte": "^2.4.18", "ajv": "^6.12.6",