diff --git a/app/cdash/app/Controller/Api/QueryTests.php b/app/cdash/app/Controller/Api/QueryTests.php index cf8998dde9..c7f39155fd 100644 --- a/app/cdash/app/Controller/Api/QueryTests.php +++ b/app/cdash/app/Controller/Api/QueryTests.php @@ -27,6 +27,9 @@ class QueryTests extends ResultsApi { + // Listing every test of a busy day can exceed PHP's memory limit. + private const MAX_TESTS = 50000; + public function __construct(Database $db, Project $project) { parent::__construct($db, $project); @@ -219,6 +222,8 @@ public function getResponse(): array unset($filterdata['xml']); $response['filterdata'] = $filterdata; $this->setFilterData($filterdata); + $limit = $filterdata['limit']; + $this->limitSQL = ' LIMIT ' . (is_int($limit) && $limit > 0 ? min($limit, self::MAX_TESTS) : self::MAX_TESTS); $response['filterurl'] = get_filterurl(); // Menu