/**
  * @since 2.3
  *
  * @return Query|null
  */
 public function getQuery()
 {
     return $this->queryResult instanceof QueryResult ? $this->queryResult->getQuery() : null;
 }
 /**
  * Build the navigation for some given query result, reuse url-tail parameters.
  *
  * @param SMWQueryResult $res
  * @param array $urlArgs
  *
  * @return string
  */
 protected function getNavigationBar(SMWQueryResult $res, array $urlArgs)
 {
     global $smwgQMaxInlineLimit, $wgLang;
     // Bug 49216
     $offset = $res->getQuery()->getOffset();
     $limit = $this->params['limit']->getValue();
     // Prepare navigation bar.
     if ($offset > 0) {
         $navigation = Html::element('a', array('href' => SpecialPage::getSafeTitleFor('Ask')->getLocalURL(array('offset' => max(0, $offset - $limit), 'limit' => $limit) + $urlArgs), 'rel' => 'nofollow'), wfMessage('smw_result_prev')->text());
     } else {
         $navigation = wfMessage('smw_result_prev')->escaped();
     }
     // @todo FIXME: i18n: Patchwork text.
     $navigation .= '&#160;&#160;&#160;&#160; <b>' . wfMessage('smw_result_results')->escaped() . ' ' . $wgLang->formatNum($offset + 1) . ' &#150; ' . $wgLang->formatNum($offset + $res->getCount()) . '</b>&#160;&#160;&#160;&#160;';
     if ($res->hasFurtherResults()) {
         $navigation .= Html::element('a', array('href' => SpecialPage::getSafeTitleFor('Ask')->getLocalURL(array('offset' => $offset + $limit, 'limit' => $limit) + $urlArgs), 'rel' => 'nofollow'), wfMessage('smw_result_next')->text());
     } else {
         $navigation .= wfMessage('smw_result_next')->escaped();
     }
     $first = true;
     foreach (array(20, 50, 100, 250, 500) as $l) {
         if ($l > $smwgQMaxInlineLimit) {
             break;
         }
         if ($first) {
             $navigation .= '&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;(';
             $first = false;
         } else {
             $navigation .= ' | ';
         }
         if ($limit != $l) {
             $navigation .= Html::element('a', array('href' => SpecialPage::getSafeTitleFor('Ask')->getLocalURL(array('offset' => $offset, 'limit' => $l) + $urlArgs), 'rel' => 'nofollow'), $l);
         } else {
             $navigation .= '<b>' . $l . '</b>';
         }
     }
     $navigation .= ')';
     return $navigation;
 }