network_id, $scope->site_id ) : new \WP_Error( 'overview_events', 'Activity evidence is currently unavailable.' );
$groups = is_array( $snapshot['groups'] ) ? Overview::groups( $snapshot['groups'], $scope->network_id, $scope->site_id ) : new \WP_Error( 'overview_groups', 'Request-group evidence is currently unavailable.' );
$activity_url = add_query_arg( array( 'page' => 'logged-ai', 'from' => $window['from_date'], 'to' => $window['to_date'] ), admin_url( 'admin.php' ) );
echo ( '
' . esc_html__( 'YOUR WORDPRESS, UNDERSTOOD', 'logged-ai' ) . '
' );
if ( null !== $provider ) { echo esc_html__( 'Your review.', 'logged-ai' ) . ' ' . esc_html__( 'In context.', 'logged-ai' ) . ' '; }
else { echo esc_html__( 'Your site.', 'logged-ai' ) . ' ' . esc_html__( 'In focus.', 'logged-ai' ) . ' '; }
echo ( ' ';
if ( current_user_can( 'logged_ai_manage_settings' ) ) {
echo '
';
}
Design::experience();
echo '
';
echo '
';
self::stat( __( 'Changes to review', 'logged-ai' ), is_wp_error( $events ) ? '—' : (string) $events['significant_count'], __( 'In the latest examined activity', 'logged-ai' ), 'incidents', true );
self::stat( __( 'Activity examined', 'logged-ai' ), is_wp_error( $events ) ? '—' : (string) $events['examined'], __( 'Up to 50 recent retained records', 'logged-ai' ), 'activity' );
self::stat( __( 'Request observations', 'logged-ai' ), is_wp_error( $groups ) ? '—' : $groups['admitted'], __( 'Within the displayed minute groups', 'logged-ai' ), 'requests' );
self::stat( __( 'Local responses', 'logged-ai' ), is_wp_error( $groups ) ? '—' : $groups['own_responses'], __( 'Recorded in those request groups', 'logged-ai' ), 'response' );
echo '
';
self::map( is_wp_error( $events ) ? null : $events['bound_events'], $scope, $now );
if ( ! is_wp_error( $events ) ) { DesignActivity::chart( $events['bound_events'], 'overview', true ); }
echo ( '
';
if ( is_wp_error( $events ) ) {
echo ( '' . esc_html__( 'Activity is unavailable. Check monitoring details below.', 'logged-ai' ) . '
' );
} elseif ( ! $events['significant'] ) {
echo ( '' . esc_html__( 'No significant changes in this sample.', 'logged-ai' ) . '' . esc_html__( 'Missing or older observations are not represented.', 'logged-ai' ) . '
' );
} else {
echo '';
foreach ( $events['significant'] as $event ) {
$url = add_query_arg( 'event', $event['id'], $activity_url );
echo '' . wp_kses( Design::icon( 'identity' === $event['category'] ? 'lock' : 'activity' ), Design::allowed_markup() ) . ' ' . esc_html( array( 'info' => __( 'info', 'logged-ai' ), 'notice' => __( 'notice', 'logged-ai' ), 'warning' => __( 'warning', 'logged-ai' ), 'high' => __( 'high', 'logged-ai' ), 'critical' => __( 'critical', 'logged-ai' ) )[ $event['severity'] ] ?? $event['severity'] ) . ' ';
}
echo ' ';
}
echo ( '' . esc_html__( 'Warning, high and critical source severity. Counts cover the latest examined records, not all site activity.', 'logged-ai' ) . '
' );
if ( null !== $provider && null !== $extension ) {
$provider->render( $extension, array( 'time' => $time, 'window' => $window ) );
}
echo '
';
self::requests( $groups, $time );
self::health( $snapshot['health'] );
if ( null === $provider && ! defined( 'LOGGED_AI_PRO_FILE' ) ) { Design::upgrade_card(); }
echo ( '
' . esc_html__( 'About this snapshot & coverage', 'logged-ai' ) . ' ' ) . esc_html( sprintf( /* translators: 1: site ID, 2: network ID, 3: display timezone, 4: snapshot timestamp. */ __( 'Site #%1$s · Network #%2$s · Display timezone: %3$s · Snapshot: %4$s', 'logged-ai' ), $scope->site_id, $scope->network_id, $zone['fallback'] ? sprintf( /* translators: %s: display timezone. */ __( '%s (UTC fallback)', 'logged-ai' ), $time->zone() ) : $time->zone(), $time->text( $now ) ) ) . '
' . esc_html( sprintf( /* translators: 1: inclusive start date, 2: exclusive end date. */ __( 'UTC interval: %1$s inclusive to %2$s exclusive. Current retention may shorten the available evidence.', 'logged-ai' ), $window['from_date'], $window['to_date'] ) ) . ( '
' . esc_html__( 'Overview counts are bounded samples. Static files, cache hits, upstream traffic, erased records and activity while collection is disabled may be absent. No common actor or successful exploit is inferred.', 'logged-ai' ) . '
' );
if ( ! is_wp_error( $events ) ) { echo '' . esc_html( $events['has_more'] ? __( 'Older events exist beyond the 50 examined records. The significant-change count is a lower bound.', 'logged-ai' ) : __( 'The event scan reached the end of retained records in this interval.', 'logged-ai' ) ) . '
'; }
if ( ! is_wp_error( $groups ) ) { echo '' . esc_html( sprintf( /* translators: 1: partial analyses count, 2: unknown final status count. */ __( 'Partial request analyses: %1$s · Unknown final status: %2$s', 'logged-ai' ), $groups['partial'], $groups['unknown'] ) . ( $groups['has_more'] ? __( ' · More request groups exist.', 'logged-ai' ) : '' ) ) . '
'; }
echo '';
$health_details( $snapshot['health'], $time );
echo '
';
}
private static function stat( string $label, string $value, string $note, string $icon, bool $featured = false ): void {
echo '' . esc_html__( 'The activity map', 'logged-ai' ) . ' ' . esc_html__( 'See where your WordPress activity happens.', 'logged-ai' ) . '
' . ' ' . esc_html__( 'SNAPSHOT', 'logged-ai' ) . '' . esc_html__( 'Go live', 'logged-ai' ) . '
' ) . wp_kses( Design::mark(), Design::allowed_markup() ) . 'WordPress
';
$map_counts=array_fill_keys(array('identity','content','configuration','commerce','other'),0);
foreach($rows as $row){$key=isset($map_counts[$row['category']])?$row['category']:'other';$map_counts[$key]++;}
foreach ( array( 'identity' => array( __( 'Users', 'logged-ai' ), 'lock' ), 'content' => array( __( 'Content', 'logged-ai' ), 'reports' ), 'configuration' => array( __( 'Site & plugins', 'logged-ai' ), 'settings' ), 'commerce' => array( __( 'Commerce', 'logged-ai' ), 'requests' ), 'other' => array( __( 'Other activity', 'logged-ai' ), 'activity' ) ) as $category => $item ) {
echo '
' . wp_kses( Design::icon( $item[1] ), Design::allowed_markup() ) . '' . (null===$events?'—':esc_html((string)$map_counts[$category])) . ' ' . esc_html( $item[0] ) . ' ';
}
echo '
' . esc_html__( 'Activity categories, not network topology. Live mode checks the latest 50 retained events every 10 seconds while this tab is visible. Overview cards remain a separate snapshot.', 'logged-ai' ) . '
' . esc_html__( 'Enable JavaScript to explore the map. All activity remains available from View activity.', 'logged-ai' ) . '
' );
}
private static function requests( array|\WP_Error $groups, TimeDisplay $time ): void {
echo ( '' . esc_html__( 'Request signals', 'logged-ai' ) . ' ' . esc_html__( 'Latest retained minute groups', 'logged-ai' ) . '
' ) . wp_kses( Design::icon( 'requests' ), Design::allowed_markup() ) . '
';
if ( is_wp_error( $groups ) ) { echo ( '' . esc_html__( 'Request evidence unavailable.', 'logged-ai' ) . '
' ); }
elseif ( ! $groups['groups'] ) { echo ( '' . esc_html__( 'No retained groups in this interval.', 'logged-ai' ) . ' ' . esc_html__( 'Coverage gaps can also produce an empty view.', 'logged-ai' ) . '
' ); }
else {
echo '';
foreach ( $groups['groups'] as $group ) {
$label = PresentationTranslations::text( RequestsClassifier::rules()[ $group['family'] ]['label'] ?? __( 'Retained request family', 'logged-ai' ) );
echo '' . esc_html( $label ) . ' ' . esc_html( Design::time_label( $time, (int) $group['window_start'] ) ) . ' ' . esc_html( sprintf( /* translators: 1: request source, 2: local response count. */ _n( '%1$s · %2$d local response', '%1$s · %2$d local responses', (int) $group['own_responses'], 'logged-ai' ), $group['source'], $group['own_responses'] ) ) . '
' . esc_html( $group['admitted_count'] ) . ( ' ' . esc_html__( 'admitted', 'logged-ai' ) . '
' );
}
echo ' ';
}
echo '' . esc_html__( 'Explore request findings', 'logged-ai' ) . ' ' ) . wp_kses( Design::icon( 'arrow' ), Design::allowed_markup() ) . '
';
}
private static function health( array $health ): void {
$capture = $health['activity_capture'];
$control = $health['collection_controls'];
$requests = $health['requests'];
$warning = 'degraded' === $capture['state'] || 'degraded' === $requests['state'] || 'unavailable' === $requests['state'];
echo '