prepare_items(); // Get analytics data. $analytics_data = self::get_analytics_data(); ?>


%1$s

', sprintf( /* translators: %s: Link to requests settings. */ \esc_html__( 'The requests logging is disabled. To enable it go to : %s', '0-day-analytics' ), '' . esc_html__( 'settings', '0-day-analytics' ) . '' ) ); ?>
%1$s

', sprintf( /* translators: %s: Link to requests settings. */ \esc_html__( 'HTTP Requests monitoring is disabled', '0-day-analytics' ), ) ); ?>
%1$s

', sprintf( /* translators: %s: Link to requests settings. */ \esc_html__( 'REST API Requests monitoring is disabled', '0-day-analytics' ), ) ); ?>
', \esc_attr( $page ) ); printf( '', \esc_attr( $paged ) ); echo '
'; $requests->search_box( __( 'Search', '0-day-analytics' ), strtolower( $requests::get_table_name() ) . '-find' ); echo '
'; $requests->display(); ?>

' . \__( 'This screen allows you to see all the requests where your WordPress site is currently running.', '0-day-analytics' ) . '

'; $help_text .= '

' . \__( 'You can specify how many rows to be shown, or filter and search for given value(s).', '0-day-analytics' ) . '

'; $help_text .= '

' . \__( 'You can delete rows - keep in mind that this operation is destructive and can not be undone - make a backup first.', '0-day-analytics' ) . '

'; $help_text .= '

' . \__( 'Bulk operations are supported.', '0-day-analytics' ) . '

'; return $help_text; } /** * Options Help * * Return help text for options screen * * @return string Help Text * * @since 2.7.0 */ public static function add_config_content_table() { Common_Table::init( Requests_Log_Entity::get_table_name() ); $table_info = Common_Table::get_table_status(); $help_text = ''; if ( ! empty( $table_info ) && isset( $table_info[0] ) ) { \ob_start(); if ( isset( $table_info[0]['Name'] ) ) { ?>
Requests_List::REQUESTS_MENU_SLUG, Requests_List::SEARCH_INPUT => Requests_List::escaped_search_input(), 'plugin' => rawurlencode( $id ), ), \admin_url( 'admin.php' ) ) ) ); exit; } } } /** * Get analytics data for the requests dashboard. * * @return array * * @since 4.8.0 */ public static function get_analytics_data() { global $wpdb; $table_name = Requests_Log_Entity::get_table_name(); // Get total requests count. $total_requests = Requests_Log_Entity::get_var( "SELECT COUNT(*) FROM {$table_name}" ); // Get requests by status. $status_counts = Requests_Log_Entity::get_results( "SELECT request_status as status, COUNT(*) as count FROM {$table_name} GROUP BY request_status", ARRAY_A ); // Get requests by type. $type_counts = Requests_Log_Entity::get_results( "SELECT type as request_type, COUNT(*) as count FROM {$table_name} GROUP BY type", ARRAY_A ); // Get average runtime. $avg_runtime = Requests_Log_Entity::get_var( "SELECT AVG(runtime) FROM {$table_name} WHERE runtime > 0" ); // Get requests in last 24 hours. $last_24h = Requests_Log_Entity::get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$table_name} WHERE date_added >= %d", strtotime( '-24 hours' ) ) ); // Get requests in last 7 days. $last_7d = Requests_Log_Entity::get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$table_name} WHERE date_added >= %d", // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared strtotime( '-7 days' ) ) ); // Get top domains. $top_domains = Requests_Log_Entity::get_results( "SELECT domain, COUNT(*) as count FROM {$table_name} WHERE domain != '' GROUP BY domain ORDER BY count DESC LIMIT 10", ARRAY_A ); // Get error rate. $error_count = Requests_Log_Entity::get_var( "SELECT COUNT(*) FROM {$table_name} WHERE status = 'error'" ); $error_rate = $total_requests > 0 ? ( $error_count / $total_requests ) * 100 : 0; // Get performance data for last 30 days. $performance_data = Requests_Log_Entity::get_results( $wpdb->prepare( "SELECT DATE(FROM_UNIXTIME(date_added)) as date, AVG(runtime) as avg_runtime, COUNT(*) as request_count FROM {$table_name} WHERE date_added >= %d GROUP BY DATE(FROM_UNIXTIME(date_added)) ORDER BY date_added DESC", strtotime( '-30 days' ) ), ARRAY_A ); return array( 'total_requests' => (int) $total_requests, 'status_counts' => $status_counts, 'type_counts' => $type_counts, 'avg_runtime' => (float) $avg_runtime, 'last_24h' => (int) $last_24h, 'last_7d' => (int) $last_7d, 'top_domains' => $top_domains, 'error_rate' => round( $error_rate, 2 ), 'performance_data' => $performance_data, ); } /** * Render the analytics dashboard. * * @param array $analytics_data The analytics data. * * @return void * * @since 4.8.0 */ public static function render_analytics_dashboard( $analytics_data ) { ?>

s

%

    'advan_requests', 'status_filter' => $status['status'], ), \admin_url( 'admin.php' ) ); ?>
  • :

    'advan_requests', 'type_filter' => $type['request_type'], ), \admin_url( 'admin.php' ) ); ?>
  • :

    'advan_requests', 'domain_filter' => $domain['domain'], ), \admin_url( 'admin.php' ) ); ?>
  • :

s