Tweaked r49408: Improved hiding and changed 1 revision case handling
[lhc/web/wiklou.git] / includes / PageHistory.php
1 <?php
2 /**
3 * Page history
4 *
5 * Split off from Article.php and Skin.php, 2003-12-22
6 * @file
7 */
8
9 /**
10 * This class handles printing the history page for an article. In order to
11 * be efficient, it uses timestamps rather than offsets for paging, to avoid
12 * costly LIMIT,offset queries.
13 *
14 * Construct it by passing in an Article, and call $h->history() to print the
15 * history.
16 *
17 */
18 class PageHistory {
19 const DIR_PREV = 0;
20 const DIR_NEXT = 1;
21
22 var $mArticle, $mTitle, $mSkin;
23 var $lastdate;
24 var $linesonpage;
25 var $mLatestId = null;
26
27 private $mOldIdChecked = 0;
28
29 /**
30 * Construct a new PageHistory.
31 *
32 * @param Article $article
33 * @returns nothing
34 */
35 function __construct( $article ) {
36 global $wgUser;
37 $this->mArticle =& $article;
38 $this->mTitle =& $article->mTitle;
39 $this->mSkin = $wgUser->getSkin();
40 $this->preCacheMessages();
41 }
42
43 function getArticle() {
44 return $this->mArticle;
45 }
46
47 function getTitle() {
48 return $this->mTitle;
49 }
50
51 /**
52 * As we use the same small set of messages in various methods and that
53 * they are called often, we call them once and save them in $this->message
54 */
55 function preCacheMessages() {
56 // Precache various messages
57 if( !isset( $this->message ) ) {
58 foreach( explode(' ', 'cur last rev-delundel' ) as $msg ) {
59 $this->message[$msg] = wfMsgExt( $msg, array( 'escape') );
60 }
61 }
62 }
63
64 /**
65 * Print the history page for an article.
66 *
67 * @returns nothing
68 */
69 function history() {
70 global $wgOut, $wgRequest, $wgScript;
71
72 /*
73 * Allow client caching.
74 */
75 if( $wgOut->checkLastModified( $this->mArticle->getTouched() ) )
76 return; // Client cache fresh and headers sent, nothing more to do.
77
78 wfProfileIn( __METHOD__ );
79
80 /*
81 * Setup page variables.
82 */
83 $wgOut->setPageTitle( wfMsg( 'history-title', $this->mTitle->getPrefixedText() ) );
84 $wgOut->setPageTitleActionText( wfMsg( 'history_short' ) );
85 $wgOut->setArticleFlag( false );
86 $wgOut->setArticleRelated( true );
87 $wgOut->setRobotPolicy( 'noindex,nofollow' );
88 $wgOut->setSyndicated( true );
89 $wgOut->setFeedAppendQuery( 'action=history' );
90 $wgOut->addScriptFile( 'history.js' );
91
92 $logPage = SpecialPage::getTitleFor( 'Log' );
93 $logLink = $this->mSkin->makeKnownLinkObj( $logPage, wfMsgHtml( 'viewpagelogs' ),
94 'page=' . $this->mTitle->getPrefixedUrl() );
95 $wgOut->setSubtitle( $logLink );
96
97 $feedType = $wgRequest->getVal( 'feed' );
98 if( $feedType ) {
99 wfProfileOut( __METHOD__ );
100 return $this->feed( $feedType );
101 }
102
103 /*
104 * Fail if article doesn't exist.
105 */
106 if( !$this->mTitle->exists() ) {
107 $wgOut->addWikiMsg( 'nohistory' );
108 wfProfileOut( __METHOD__ );
109 return;
110 }
111
112 /**
113 * Add date selector to quickly get to a certain time
114 */
115 $year = $wgRequest->getInt( 'year' );
116 $month = $wgRequest->getInt( 'month' );
117 $tagFilter = $wgRequest->getVal( 'tagfilter' );
118 $tagSelector = ChangeTags::buildTagFilterSelector( $tagFilter );
119
120 $action = htmlspecialchars( $wgScript );
121 $wgOut->addHTML(
122 "<form action=\"$action\" method=\"get\" id=\"mw-history-searchform\">" .
123 Xml::fieldset( wfMsg( 'history-fieldset-title' ), false, array( 'id' => 'mw-history-search' ) ) .
124 Xml::hidden( 'title', $this->mTitle->getPrefixedDBKey() ) . "\n" .
125 Xml::hidden( 'action', 'history' ) . "\n" .
126 xml::dateMenu( $year, $month ) . '&nbsp;' .
127 ( $tagSelector ? ( implode( '&nbsp;', $tagSelector ) . '&nbsp;' ) : '' ) .
128 Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "\n" .
129 '</fieldset></form>'
130 );
131
132 wfRunHooks( 'PageHistoryBeforeList', array( &$this->mArticle ) );
133
134 /**
135 * Do the list
136 */
137 $pager = new PageHistoryPager( $this, $year, $month, $tagFilter );
138 $this->linesonpage = $pager->getNumRows();
139 $wgOut->addHTML(
140 $pager->getNavigationBar() .
141 $this->beginHistoryList() .
142 $pager->getBody() .
143 $this->endHistoryList() .
144 $pager->getNavigationBar()
145 );
146
147 wfProfileOut( __METHOD__ );
148 }
149
150 /**
151 * Creates begin of history list with a submit button
152 *
153 * @return string HTML output
154 */
155 function beginHistoryList() {
156 global $wgUser, $wgScript, $wgEnableHtmlDiff;
157 $this->lastdate = '';
158 $s = wfMsgExt( 'histlegend', array( 'parse') );
159 if( $this->linesonpage > 1 && $wgUser->isAllowed('deleterevision') ) {
160 $revdel = SpecialPage::getTitleFor( 'Revisiondelete' );
161 $s .= Xml::openElement( 'form',
162 array(
163 'action' => $revdel->getFullUrl(),
164 'method' => 'get', 'id' => 'mw-history-revdeleteform',
165 'style' => 'visibility:hidden;float:right;'
166 )
167 );
168 $s .= Xml::hidden( 'target', $this->mTitle->getPrefixedDbKey() );
169 $s .= Xml::hidden( 'oldid', '', array('id'=>'revdel-oldid') );
170 $s .= Xml::submitButton( wfMsg( 'showhideselectedversions' ) );
171 $s .= Xml::closeElement( 'form' );
172 }
173 $s .= Xml::openElement( 'form', array( 'action' => $wgScript,
174 'id' => 'mw-history-compare' ) );
175 $s .= Xml::hidden( 'title', $this->mTitle->getPrefixedDbKey() );
176 if( $wgEnableHtmlDiff ) {
177 $s .= $this->submitButton( wfMsg( 'visualcomparison'),
178 array(
179 'name' => 'htmldiff',
180 'class' => 'historysubmit',
181 'accesskey' => wfMsg( 'accesskey-visualcomparison' ),
182 'title' => wfMsg( 'tooltip-compareselectedversions' ),
183 )
184 );
185 $s .= $this->submitButton( wfMsg( 'wikicodecomparison'),
186 array(
187 'class' => 'historysubmit',
188 'accesskey' => wfMsg( 'accesskey-compareselectedversions' ),
189 'title' => wfMsg( 'tooltip-compareselectedversions' ),
190 )
191 );
192 } else {
193 $s .= $this->submitButton( wfMsg( 'compareselectedversions'),
194 array(
195 'class' => 'historysubmit',
196 'accesskey' => wfMsg( 'accesskey-compareselectedversions' ),
197 'title' => wfMsg( 'tooltip-compareselectedversions' ),
198 )
199 );
200 }
201 $s .= '<ul id="pagehistory">' . "\n";
202 return $s;
203 }
204
205 /**
206 * Creates end of history list with a submit button
207 *
208 * @return string HTML output
209 */
210 function endHistoryList() {
211 global $wgEnableHtmlDiff;
212 $s = '</ul>';
213 if( $wgEnableHtmlDiff ) {
214 $s .= $this->submitButton( wfMsg( 'visualcomparison'),
215 array(
216 'name' => 'htmldiff',
217 'class' => 'historysubmit',
218 'accesskey' => wfMsg( 'accesskey-visualcomparison' ),
219 'title' => wfMsg( 'tooltip-compareselectedversions' ),
220 )
221 );
222 $s .= $this->submitButton( wfMsg( 'wikicodecomparison'),
223 array(
224 'class' => 'historysubmit',
225 'accesskey' => wfMsg( 'accesskey-compareselectedversions' ),
226 'title' => wfMsg( 'tooltip-compareselectedversions' ),
227 )
228 );
229 } else {
230 $s .= $this->submitButton( wfMsg( 'compareselectedversions'),
231 array(
232 'class' => 'historysubmit',
233 'accesskey' => wfMsg( 'accesskey-compareselectedversions' ),
234 'title' => wfMsg( 'tooltip-compareselectedversions' ),
235 )
236 );
237 }
238 $s .= '</form>';
239 return $s;
240 }
241
242 /**
243 * Creates a submit button
244 *
245 * @param array $attributes attributes
246 * @return string HTML output for the submit button
247 */
248 function submitButton($message, $attributes = array() ) {
249 # Disable submit button if history has 1 revision only
250 if( $this->linesonpage > 1 ) {
251 return Xml::submitButton( $message , $attributes );
252 } else {
253 return '';
254 }
255 }
256
257 /**
258 * Returns a row from the history printout.
259 *
260 * @todo document some more, and maybe clean up the code (some params redundant?)
261 *
262 * @param Row $row The database row corresponding to the previous line.
263 * @param mixed $next The database row corresponding to the next line.
264 * @param int $counter Apparently a counter of what row number we're at, counted from the top row = 1.
265 * @param $notificationtimestamp
266 * @param bool $latest Whether this row corresponds to the page's latest revision.
267 * @param bool $firstInList Whether this row corresponds to the first displayed on this history page.
268 * @return string HTML output for the row
269 */
270 function historyLine( $row, $next, $counter = '', $notificationtimestamp = false,
271 $latest = false, $firstInList = false )
272 {
273 global $wgUser, $wgLang;
274 $rev = new Revision( $row );
275 $rev->setTitle( $this->mTitle );
276
277 $curlink = $this->curLink( $rev, $latest );
278 $lastlink = $this->lastLink( $rev, $next, $counter );
279 $arbitrary = $this->diffButtons( $rev, $firstInList, $counter );
280 $link = $this->revLink( $rev );
281 $classes = array();
282
283 $s = "($curlink) ($lastlink) $arbitrary";
284
285 if( $wgUser->isAllowed( 'deleterevision' ) ) {
286 // Hide JS by default for non-JS browsing
287 $hidden = array( 'style' => 'display:none' );
288 // If revision was hidden from sysops
289 if( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) {
290 $del = Xml::check( 'deleterevisions', false,
291 $hidden + array('disabled' => 'disabled') );
292 $del .= Xml::tags( 'span', array( 'class'=>'mw-revdelundel-link' ),
293 '(' . $this->message['rev-delundel'] . ')' );
294 // Otherwise, show the link...
295 } else {
296 $jsCall = 'updateShowHideForm('.$rev->getId().',this.checked)';
297 $del = Xml::check( 'showhiderevisions', false,
298 $hidden + array('onchange' => $jsCall) );
299 $query = array( 'target' => $this->mTitle->getPrefixedDbkey(),
300 'oldid' => $rev->getId() );
301 $del .= $this->mSkin->revDeleteLink( $query,
302 $rev->isDeleted( Revision::DELETED_RESTRICTED ) );
303 }
304 $s .= " $del ";
305 }
306
307 $s .= " $link";
308 $s .= " <span class='history-user'>" . $this->mSkin->revUserTools( $rev, true ) . "</span>";
309
310 if( $rev->isMinor() ) {
311 $s .= ' ' . Xml::element( 'span', array( 'class' => 'minor' ), wfMsg( 'minoreditletter') );
312 }
313
314 if( !is_null( $size = $rev->getSize() ) && !$rev->isDeleted( Revision::DELETED_TEXT ) ) {
315 $s .= ' ' . $this->mSkin->formatRevisionSize( $size );
316 }
317
318 $s .= $this->mSkin->revComment( $rev, false, true );
319
320 if( $notificationtimestamp && ($row->rev_timestamp >= $notificationtimestamp) ) {
321 $s .= ' <span class="updatedmarker">' . wfMsgHtml( 'updatedmarker' ) . '</span>';
322 }
323 if( $rev->isDeleted( Revision::DELETED_TEXT ) ) {
324 $s .= ' <tt>' . wfMsgHtml( 'deletedrev' ) . '</tt>';
325 }
326
327 $tools = array();
328
329 if( !is_null( $next ) && is_object( $next ) ) {
330 if( $latest && $this->mTitle->userCan( 'rollback' ) && $this->mTitle->userCan( 'edit' ) ) {
331 $tools[] = '<span class="mw-rollback-link">'.$this->mSkin->buildRollbackLink( $rev ).'</span>';
332 }
333
334 if( $this->mTitle->quickUserCan( 'edit' ) && !$rev->isDeleted( Revision::DELETED_TEXT ) &&
335 !$next->rev_deleted & Revision::DELETED_TEXT )
336 {
337 # Create undo tooltip for the first (=latest) line only
338 $undoTooltip = $latest
339 ? array( 'title' => wfMsg( 'tooltip-undo' ) )
340 : array();
341 $undolink = $this->mSkin->link(
342 $this->mTitle,
343 wfMsgHtml( 'editundo' ),
344 $undoTooltip,
345 array( 'action' => 'edit', 'undoafter' => $next->rev_id, 'undo' => $rev->getId() ),
346 array( 'known', 'noclasses' )
347 );
348 $tools[] = "<span class=\"mw-history-undo\">{$undolink}</span>";
349 }
350 }
351
352 if( $tools ) {
353 $s .= ' (' . $wgLang->pipeList( $tools ) . ')';
354 }
355
356 # Tags
357 list($tagSummary, $newClasses) = ChangeTags::formatSummaryRow( $row->ts_tags, 'history' );
358 $classes = array_merge( $classes, $newClasses );
359 $s .= " $tagSummary";
360
361 wfRunHooks( 'PageHistoryLineEnding', array( $this, &$row , &$s ) );
362
363 $classes = implode( ' ', $classes );
364
365 return "<li class=\"$classes\">$s</li>\n";
366 }
367
368 /**
369 * Create a link to view this revision of the page
370 * @param Revision $rev
371 * @returns string
372 */
373 function revLink( $rev ) {
374 global $wgLang;
375 $date = $wgLang->timeanddate( wfTimestamp(TS_MW, $rev->getTimestamp()), true );
376 if( $rev->userCan( Revision::DELETED_TEXT ) ) {
377 $link = $this->mSkin->makeKnownLinkObj( $this->mTitle, $date, "oldid=" . $rev->getId() );
378 } else {
379 $link = $date;
380 }
381 if( $rev->isDeleted( Revision::DELETED_TEXT ) ) {
382 $link = "<span class=\"history-deleted\">$link</span>";
383 }
384 return $link;
385 }
386
387 /**
388 * Create a diff-to-current link for this revision for this page
389 * @param Revision $rev
390 * @param Bool $latest, this is the latest revision of the page?
391 * @returns string
392 */
393 function curLink( $rev, $latest ) {
394 $cur = $this->message['cur'];
395 if( $latest || !$rev->userCan( Revision::DELETED_TEXT ) ) {
396 return $cur;
397 } else {
398 return $this->mSkin->makeKnownLinkObj( $this->mTitle, $cur,
399 'diff=' . $this->mTitle->getLatestRevID() . "&oldid=" . $rev->getId() );
400 }
401 }
402
403 /**
404 * Create a diff-to-previous link for this revision for this page.
405 * @param Revision $prevRev, the previous revision
406 * @param mixed $next, the newer revision
407 * @param int $counter, what row on the history list this is
408 * @returns string
409 */
410 function lastLink( $prevRev, $next, $counter ) {
411 $last = $this->message['last'];
412 # $next may either be a Row, null, or "unkown"
413 $nextRev = is_object($next) ? new Revision( $next ) : $next;
414 if( is_null($next) ) {
415 # Probably no next row
416 return $last;
417 } elseif( $next === 'unknown' ) {
418 # Next row probably exists but is unknown, use an oldid=prev link
419 return $this->mSkin->makeKnownLinkObj( $this->mTitle, $last,
420 "diff=" . $prevRev->getId() . "&oldid=prev" );
421 } elseif( !$prevRev->userCan(Revision::DELETED_TEXT) || !$nextRev->userCan(Revision::DELETED_TEXT) ) {
422 return $last;
423 } else {
424 return $this->mSkin->makeKnownLinkObj( $this->mTitle, $last,
425 "diff=" . $prevRev->getId() . "&oldid={$next->rev_id}" );
426 }
427 }
428
429 /**
430 * Create radio buttons for page history
431 *
432 * @param object $rev Revision
433 * @param bool $firstInList Is this version the first one?
434 * @param int $counter A counter of what row number we're at, counted from the top row = 1.
435 * @return string HTML output for the radio buttons
436 */
437 function diffButtons( $rev, $firstInList, $counter ) {
438 if( $this->linesonpage > 1 ) {
439 $radio = array( 'type' => 'radio', 'value' => $rev->getId() );
440 /** @todo: move title texts to javascript */
441 if( $firstInList ) {
442 $first = Xml::element( 'input',
443 array_merge( $radio, array( 'style' => 'visibility:hidden', 'name' => 'oldid' ) )
444 );
445 $checkmark = array( 'checked' => 'checked' );
446 } else {
447 # Check visibility of old revisions
448 if( !$rev->userCan( Revision::DELETED_TEXT ) ) {
449 $radio['disabled'] = 'disabled';
450 $checkmark = array(); // We will check the next possible one
451 } else if( $counter == 2 || !$this->mOldIdChecked ) {
452 $checkmark = array( 'checked' => 'checked' );
453 $this->mOldIdChecked = $rev->getId();
454 } else {
455 $checkmark = array();
456 }
457 $first = Xml::element( 'input', array_merge( $radio, $checkmark, array( 'name' => 'oldid' ) ) );
458 $checkmark = array();
459 }
460 $second = Xml::element( 'input', array_merge( $radio, $checkmark, array( 'name' => 'diff' ) ) );
461 return $first . $second;
462 } else {
463 return '';
464 }
465 }
466
467 /**
468 * Fetch an array of revisions, specified by a given limit, offset and
469 * direction. This is now only used by the feeds. It was previously
470 * used by the main UI but that's now handled by the pager.
471 */
472 function fetchRevisions($limit, $offset, $direction) {
473 $dbr = wfGetDB( DB_SLAVE );
474
475 if( $direction == PageHistory::DIR_PREV )
476 list($dirs, $oper) = array("ASC", ">=");
477 else /* $direction == PageHistory::DIR_NEXT */
478 list($dirs, $oper) = array("DESC", "<=");
479
480 if( $offset )
481 $offsets = array("rev_timestamp $oper '$offset'");
482 else
483 $offsets = array();
484
485 $page_id = $this->mTitle->getArticleID();
486
487 return $dbr->select( 'revision',
488 Revision::selectFields(),
489 array_merge(array("rev_page=$page_id"), $offsets),
490 __METHOD__,
491 array( 'ORDER BY' => "rev_timestamp $dirs",
492 'USE INDEX' => 'page_timestamp', 'LIMIT' => $limit)
493 );
494 }
495
496 /**
497 * Output a subscription feed listing recent edits to this page.
498 * @param string $type
499 */
500 function feed( $type ) {
501 global $wgFeedClasses, $wgRequest, $wgFeedLimit;
502 if( !FeedUtils::checkFeedOutput($type) ) {
503 return;
504 }
505
506 $feed = new $wgFeedClasses[$type](
507 $this->mTitle->getPrefixedText() . ' - ' .
508 wfMsgForContent( 'history-feed-title' ),
509 wfMsgForContent( 'history-feed-description' ),
510 $this->mTitle->getFullUrl( 'action=history' ) );
511
512 // Get a limit on number of feed entries. Provide a sane default
513 // of 10 if none is defined (but limit to $wgFeedLimit max)
514 $limit = $wgRequest->getInt( 'limit', 10 );
515 if( $limit > $wgFeedLimit || $limit < 1 ) {
516 $limit = 10;
517 }
518 $items = $this->fetchRevisions($limit, 0, PageHistory::DIR_NEXT);
519
520 $feed->outHeader();
521 if( $items ) {
522 foreach( $items as $row ) {
523 $feed->outItem( $this->feedItem( $row ) );
524 }
525 } else {
526 $feed->outItem( $this->feedEmpty() );
527 }
528 $feed->outFooter();
529 }
530
531 function feedEmpty() {
532 global $wgOut;
533 return new FeedItem(
534 wfMsgForContent( 'nohistory' ),
535 $wgOut->parse( wfMsgForContent( 'history-feed-empty' ) ),
536 $this->mTitle->getFullUrl(),
537 wfTimestamp( TS_MW ),
538 '',
539 $this->mTitle->getTalkPage()->getFullUrl() );
540 }
541
542 /**
543 * Generate a FeedItem object from a given revision table row
544 * Borrows Recent Changes' feed generation functions for formatting;
545 * includes a diff to the previous revision (if any).
546 *
547 * @param $row
548 * @return FeedItem
549 */
550 function feedItem( $row ) {
551 $rev = new Revision( $row );
552 $rev->setTitle( $this->mTitle );
553 $text = FeedUtils::formatDiffRow( $this->mTitle,
554 $this->mTitle->getPreviousRevisionID( $rev->getId() ),
555 $rev->getId(),
556 $rev->getTimestamp(),
557 $rev->getComment() );
558
559 if( $rev->getComment() == '' ) {
560 global $wgContLang;
561 $title = wfMsgForContent( 'history-feed-item-nocomment',
562 $rev->getUserText(),
563 $wgContLang->timeanddate( $rev->getTimestamp() ) );
564 } else {
565 $title = $rev->getUserText() . wfMsgForContent( 'colon-separator' ) . FeedItem::stripComment( $rev->getComment() );
566 }
567
568 return new FeedItem(
569 $title,
570 $text,
571 $this->mTitle->getFullUrl( 'diff=' . $rev->getId() . '&oldid=prev' ),
572 $rev->getTimestamp(),
573 $rev->getUserText(),
574 $this->mTitle->getTalkPage()->getFullUrl() );
575 }
576 }
577
578
579 /**
580 * @ingroup Pager
581 */
582 class PageHistoryPager extends ReverseChronologicalPager {
583 public $mLastRow = false, $mPageHistory, $mTitle;
584
585 function __construct( $pageHistory, $year='', $month='', $tagFilter = '' ) {
586 parent::__construct();
587 $this->mPageHistory = $pageHistory;
588 $this->mTitle =& $this->mPageHistory->mTitle;
589 $this->tagFilter = $tagFilter;
590 $this->getDateCond( $year, $month );
591 }
592
593 function getQueryInfo() {
594 $queryInfo = array(
595 'tables' => array('revision'),
596 'fields' => array_merge( Revision::selectFields(), array('ts_tags') ),
597 'conds' => array('rev_page' => $this->mPageHistory->mTitle->getArticleID() ),
598 'options' => array( 'USE INDEX' => array('revision' => 'page_timestamp') ),
599 'join_conds' => array( 'tag_summary' => array( 'LEFT JOIN', 'ts_rev_id=rev_id' ) ),
600 );
601 ChangeTags::modifyDisplayQuery( $queryInfo['tables'],
602 $queryInfo['fields'],
603 $queryInfo['conds'],
604 $queryInfo['join_conds'],
605 $queryInfo['options'],
606 $this->tagFilter );
607 wfRunHooks( 'PageHistoryPager::getQueryInfo', array( &$this, &$queryInfo ) );
608 return $queryInfo;
609 }
610
611 function getIndexField() {
612 return 'rev_timestamp';
613 }
614
615 function formatRow( $row ) {
616 if( $this->mLastRow ) {
617 $latest = $this->mCounter == 1 && $this->mIsFirst;
618 $firstInList = $this->mCounter == 1;
619 $s = $this->mPageHistory->historyLine( $this->mLastRow, $row, $this->mCounter++,
620 $this->mTitle->getNotificationTimestamp(), $latest, $firstInList );
621 } else {
622 $s = '';
623 }
624 $this->mLastRow = $row;
625 return $s;
626 }
627
628 function getStartBody() {
629 $this->mLastRow = false;
630 $this->mCounter = 1;
631 return '';
632 }
633
634 function getEndBody() {
635 if( $this->mLastRow ) {
636 $latest = $this->mCounter == 1 && $this->mIsFirst;
637 $firstInList = $this->mCounter == 1;
638 if( $this->mIsBackwards ) {
639 # Next row is unknown, but for UI reasons, probably exists if an offset has been specified
640 if( $this->mOffset == '' ) {
641 $next = null;
642 } else {
643 $next = 'unknown';
644 }
645 } else {
646 # The next row is the past-the-end row
647 $next = $this->mPastTheEndRow;
648 }
649 $s = $this->mPageHistory->historyLine( $this->mLastRow, $next, $this->mCounter++,
650 $this->mTitle->getNotificationTimestamp(), $latest, $firstInList );
651 } else {
652 $s = '';
653 }
654 return $s;
655 }
656 }