repository->counts();
$found = $this->log->counts();
$top = $this->unfixed( $this->log->top( 15 ), 5 );
printf( '
';
}
/**
* Leave out addresses a redirect already covers. They can still be in the list — a
* redirect turned back on, or one added before the address was first seen — and a
* "Fix" link for something already fixed sends somebody to a form that will refuse.
*
* @param list> $rows
* @return list>
*/
private function unfixed( array $rows, int $limit ): array {
$engine = new Engine( $this->repository );
$visitor = Validator::neutral();
$out = [];
foreach ( $rows as $row ) {
$address = Address::from_request( (string) $row['url'] );
if ( null !== $engine->resolve( $address, $visitor ) || null !== $engine->resolve( $address, $visitor->with( [ 'not_found' => true ] ), 'late' ) ) {
continue;
}
$out[] = $row;
if ( count( $out ) >= $limit ) {
break;
}
}
return $out;
}
private function stat( string $number, string $label, string $url ): void {
printf(
'%s%s',
esc_url( $url ),
esc_html( $number ),
esc_html( $label )
);
}
}