diff --git a/includes/actions/pagers/HistoryPager.php b/includes/actions/pagers/HistoryPager.php
index f7181ada59b..0d46869dfaf 100644
--- a/includes/actions/pagers/HistoryPager.php
+++ b/includes/actions/pagers/HistoryPager.php
@@ -171,6 +171,14 @@ class HistoryPager extends ReverseChronologicalPager {
$this->mResult->seek( 0 );
}
+ /**
+ * Returns message when query returns no revisions
+ * @return string escaped message
+ */
+ protected function getEmptyBody() {
+ return $this->msg( 'history-empty' )->escaped();
+ }
+
/**
* Creates begin of history list with a submit button
*
@@ -181,17 +189,19 @@ class HistoryPager extends ReverseChronologicalPager {
$this->lastRow = false;
$this->counter = 1;
$this->oldIdChecked = 0;
-
- $this->getOutput()->wrapWikiMsg( "
\n$1\n
", 'histlegend' );
- $s = Html::openElement( 'form', [ 'action' => wfScript(),
- 'id' => 'mw-history-compare' ] ) . "\n";
- $s .= Html::hidden( 'title', $this->getTitle()->getPrefixedDBkey() ) . "\n";
- $s .= Html::hidden( 'action', 'historysubmit' ) . "\n";
- $s .= Html::hidden( 'type', 'revision' ) . "\n";
-
+ $s = '';
// Button container stored in $this->buttons for re-use in getEndBody()
$this->buttons = '';
if ( $this->getNumRows() > 0 ) {
+ $this->getOutput()->wrapWikiMsg( "\n$1\n
", 'histlegend' );
+ $s = Html::openElement( 'form', [
+ 'action' => wfScript(),
+ 'id' => 'mw-history-compare'
+ ] ) . "\n";
+ $s .= Html::hidden( 'title', $this->getTitle()->getPrefixedDBkey() ) . "\n";
+ $s .= Html::hidden( 'action', 'historysubmit' ) . "\n";
+ $s .= Html::hidden( 'type', 'revision' ) . "\n";
+
$this->buttons .= Html::openElement(
'div', [ 'class' => 'mw-history-compareselectedversions' ] );
$className = 'historysubmit mw-history-compareselectedversions-button mw-ui-button';
@@ -223,8 +233,8 @@ class HistoryPager extends ReverseChronologicalPager {
$this->buttons .= '';
$s .= $this->buttons;
+ $s .= '' . "\n";
}
- $s .= '' . "\n";
return $s;
}
@@ -245,6 +255,10 @@ class HistoryPager extends ReverseChronologicalPager {
}
protected function getEndBody() {
+ if ( $this->getNumRows() == 0 ) {
+ return '';
+ }
+
if ( $this->lastRow ) {
$firstInList = $this->counter == 1;
if ( $this->mIsBackwards ) {
@@ -274,7 +288,6 @@ class HistoryPager extends ReverseChronologicalPager {
$s .= $this->buttons;
}
$s .= '';
-
return $s;
}
diff --git a/languages/i18n/en.json b/languages/i18n/en.json
index b138541fd53..3c2cb4f7086 100644
--- a/languages/i18n/en.json
+++ b/languages/i18n/en.json
@@ -864,6 +864,7 @@
"history-feed-item-nocomment": "$1 at $2",
"history-feed-empty": "The requested page does not exist.\nIt may have been deleted from the wiki, or renamed.\nTry [[Special:Search|searching on the wiki]] for relevant new pages.",
"history-edit-tags": "Edit tags of selected revisions",
+ "history-empty": "No matching revisions were found.",
"rev-deleted-comment": "(edit summary removed)",
"rev-deleted-user": "(username removed)",
"rev-deleted-event": "(log details removed)",
diff --git a/languages/i18n/qqq.json b/languages/i18n/qqq.json
index ca5cfc1f1a8..fb71e939b3b 100644
--- a/languages/i18n/qqq.json
+++ b/languages/i18n/qqq.json
@@ -1079,6 +1079,7 @@
"history-feed-item-nocomment": "Title for each revision when viewing the RSS/Atom [[:w:en:web feed|feed]] for a page history.\n\nParameters:\n* $1 - username\n* $2 - date/time\n* $3 - (Optional) date\n* $4 - (Optional) time",
"history-feed-empty": "Used as summary of the RSS/Atom feed for a page history when the feed is empty.\nSee [{{canonicalurl:x|feed=atom&action=history}} example].",
"history-edit-tags": "Text of button used to access change tagging interface. For more information on tags see [[mw:Manual:Tags]].",
+ "history-empty": "Text shown to user when no revision is returned by the query.",
"rev-deleted-comment": "Apparently this can also be about the reason of a log action, not only an edit summary. See also:\n*{{msg-mw|revdelete-hide-comment}}",
"rev-deleted-user": "See also:\n* {{msg-mw|Rev-deleted-event}}",
"rev-deleted-event": "See also:\n* {{msg-mw|Rev-deleted-user}}",