- $s = "<ol start='" . ( $offset + 1 ) . "'>";
- # Only read at most $num rows, because $res may contain the whole 1000
- for ( $i = 0; $i < $num && $obj = $dbr->fetchObject( $res ); $i++ ) {
- $format = $this->formatResult( $sk, $obj );
- $s .= "<li>{$format}</li>\n";
+ if ( $num > 0 ) {
+ $s = "<ol start='" . ( $offset + 1 ) . "' class='special'>";
+
+ # Only read at most $num rows, because $res may contain the whole 1000
+ for ( $i = 0; $i < $num && $obj = $dbr->fetchObject( $res ); $i++ ) {
+ $format = $this->formatResult( $sk, $obj );
+ if ( $format ) {
+ $attr = ( isset ( $obj->usepatrol ) && $obj->usepatrol &&
+ $obj->patrolled == 0 ) ? ' class="not-patrolled"' : '';
+ $s .= "<li{$attr}>{$format}</li>\n";
+ }
+ }
+
+ if($this->tryLastResult()) {
+ // flush the very last result
+ $obj = null;
+ $format = $this->formatResult( $sk, $obj );
+ if( $format ) {
+ $attr = ( isset ( $obj->usepatrol ) && $obj->usepatrol &&
+ $obj->patrolled == 0 ) ? ' class="not-patrolled"' : '';
+ $s .= "<li{$attr}>{$format}</li>\n";
+ }
+ }
+
+ $dbr->freeResult( $res );
+ $s .= '</ol>';
+ $wgOut->addHTML( $s );