It turns out that numSearchResults and OPACnumSearchResults are not sanity checked. If you have high numbers in these system preferences, your search results are going to get very slow, and your browser may actually struggle to render the large quantity of HTML. At a glance, we actually look up these sysprefs in more places than you'd think... and since we use the "preference" function, we don't have an existing way of doing sanity checks (either at setting time or getting time). -- I'd say the options look like building sanity checks into the "preference" function, starting a Koha::Search object that can be used for getting search information, or adding something into our current search classes (although that might be too heavy weight for some contexts). -- Due to the volume of system preferences, obviously adding sanity checks to all system preferences could get unwieldy. But I reckon something needs to be done.
I've checked Hea for numSearchResults and OPACnumSearchResults, but they don't appear in the results, which is unfortunate.
By the way, when numSearchResultsDropdown is enabled, the max results able to be chosen by the dropdown menu is 100. Perhaps that would be a sane max limit to enforce for these system preferences.