Back to Pagination class

Method getResultsCounter

public string
getResultsCounter
()
Create and return the pagination result set counter string, e.g. Results 1-10 of 42
Returns
  • string Pagination result set counter string.
Since
  • 1.5
Class: Pagination
Project: Joomla

Method getResultsCounter - Source code

/**
 * Create and return the pagination result set counter string, e.g. Results 1-10 of 42
 *
 * @return  string   Pagination result set counter string.
 *
 * @since   1.5
 */
public function getResultsCounter()
{
    $html = null;
    $fromResult = $this->limitstart + 1;
    // If the limit is reached before the end of the list.
    if ($this->limitstart + $this->limit < $this->total) {
        $toResult = $this->limitstart + $this->limit;
    } else {
        $toResult = $this->total;
    }
    // If there are results found.
    if ($this->total > 0) {
        $msg = Text::sprintf('JLIB_HTML_RESULTS_OF', $fromResult, $toResult, $this->total);
        $html .= "\n" . $msg;
    } else {
        $html .= "\n" . Text::_('JLIB_HTML_NO_RECORDS_FOUND');
    }
    return $html;
}