diff options
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/Config/Query.pm | 10 | ||||
-rw-r--r-- | Bugzilla/Search.pm | 6 |
2 files changed, 14 insertions, 2 deletions
diff --git a/Bugzilla/Config/Query.pm b/Bugzilla/Config/Query.pm index 821f09fc6..3513b12e3 100644 --- a/Bugzilla/Config/Query.pm +++ b/Bugzilla/Config/Query.pm @@ -71,8 +71,14 @@ sub get_param_list { name => 'specific_search_allow_empty_words', type => 'b', default => 1 - } - + }, + + { + name => 'max_search_results', + type => 't', + default => '10000', + checker => \&check_numeric + }, ); return @param_list; } diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index 224193fbc..2bd4c06c9 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -929,6 +929,12 @@ sub _sql_limit { my ($self) = @_; my $limit = $self->_params->{limit}; my $offset = $self->_params->{offset}; + + my $max_results = Bugzilla->params->{'max_search_results'}; + if (!$self->{allow_unlimited} && (!$limit || $limit > $max_results)) { + $limit = $max_results; + } + if (defined $offset and not defined $limit) { $limit = INT_MAX; } |