' . esc_html__( 'The 404 error log has been cleared.', 'advanced-redirect-manager' ) . '

'; } // Interrogo direttamente il database per ottenere i log. global $wpdb; $table_name = $wpdb->prefix . 'ncb_arm_404_log'; $log_limit = (int) get_option( NCB_ARM_404_Logger::LOG_LIMIT_OPTION_NAME, 200 ); $log_data = []; // Prima di eseguire la query, verifico che la tabella esista. // È una misura di sicurezza in caso di attivazione fallita del plugin. $table_exists = $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE %s", $table_name ) ) === $table_name; if ( $table_exists ) { // Eseguo la query per recuperare le ultime N voci, ordinate per data decrescente. $log_data = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$table_name} ORDER BY timestamp DESC LIMIT %d", $log_limit ), ARRAY_A // Chiedo i risultati come array associativo. ); } ?>

'advanced-redirect-manager', 'tab' => 'redirect_rules', 'action' => 'add-from-404', 'url_from' => urlencode( $path ), ), admin_url( 'options-general.php' ) ); // Il timestamp dal database è una stringa (es. '2023-10-27 10:30:00'). // La converto in un timestamp UNIX per poterla formattare. $timestamp_unix = strtotime( $entry['timestamp'] ); ?>