Current way of counting returned search results (e.g. for
Event Logging) relies on counting the appropriate elements
in the search results page's DOM, up to the limit the user
requested (e.g. 20 by default). This allows us to record
the total number and the offset, useful for event logging.
For example, if we wanted to know whether the user viewed
2nd or 3rd set of search results.
Change-Id: Ic8601e9eeddac84ba8e0d7dc6f127bf360b6f90f
if ( $totalResults > 0 && $offset < $totalResults ) {
$html .= Xml::tags(
'div',
- [ 'class' => 'results-info' ],
+ [
+ 'class' => 'results-info',
+ 'data-mw-num-results-offset' => $offset,
+ 'data-mw-num-results-total' => $totalResults
+ ],
$this->specialSearch->msg( 'search-showingresults' )
->numParams( $offset + 1, $offset + $numResults, $totalResults )
->numParams( $numResults )