prefix . 'eistat_'; // phpcs:ignore WordPress.Security.NonceVerification.Recommended $eistat_date = isset($_GET['date']) ? sanitize_text_field(wp_unslash($_GET['date'])) : ''; if (!preg_match('/^\d{4}-\d{2}-\d{2}$/', $eistat_date)) { echo '

' . esc_html__('Invalid date.', 'statinform') . '

'; return; } // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter $eistat_day_row = $wpdb->get_row($wpdb->prepare( "SELECT * FROM {$eistat_p}daily WHERE date = %s", $eistat_date )); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter $eistat_top_pages = $wpdb->get_results($wpdb->prepare( "SELECT page_id, page_type, page_url, views, unique_views, total_time FROM {$eistat_p}pageviews WHERE date = %s ORDER BY views DESC LIMIT 50", $eistat_date )); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter $eistat_sources = $wpdb->get_results($wpdb->prepare( "SELECT source, SUM(sessions) AS s, SUM(pageviews) AS pv, SUM(total_duration) AS dur FROM {$eistat_p}sources WHERE date = %s GROUP BY source ORDER BY s DESC", $eistat_date )); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter $eistat_ip_stats = $wpdb->get_row($wpdb->prepare( "SELECT COUNT(DISTINCT ip_hash) AS total_ips, COUNT(DISTINCT CASE WHEN visits >= 2 THEN ip_hash END) AS repeat_ips FROM ( SELECT ip_hash, COUNT(*) AS visits FROM {$eistat_p}sessions WHERE date = %s AND is_bot = 0 GROUP BY ip_hash ) t", $eistat_date )); $eistat_per_page = 100; // phpcs:ignore WordPress.Security.NonceVerification.Recommended $eistat_page_num = max(1, (int) (isset($_GET['paged']) ? absint(wp_unslash($_GET['paged'])) : 1)); $eistat_offset = ($eistat_page_num - 1) * $eistat_per_page; // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter $eistat_total_sessions = (int) $wpdb->get_var($wpdb->prepare( "SELECT COUNT(*) FROM {$eistat_p}sessions WHERE date = %s", $eistat_date )); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter $eistat_sessions = $wpdb->get_results($wpdb->prepare( "SELECT * FROM {$eistat_p}sessions WHERE date = %s ORDER BY first_seen DESC LIMIT %d OFFSET %d", $eistat_date, $eistat_per_page, $eistat_offset )); ?>

←

sessions; $eistat_b = (int) $eistat_day_row->bot_sessions; $eistat_h = $eistat_s - $eistat_b; $eistat_pv = (int) $eistat_day_row->pageviews; $eistat_dur_human = $eistat_h > 0 ? round($eistat_day_row->total_duration_human / $eistat_h) : 0; $eistat_dur_all = $eistat_s > 0 ? round($eistat_day_row->total_duration / $eistat_s) : 0; $eistat_dur_approx_human = $eistat_h > 0 ? round($eistat_day_row->total_duration_approx_human / $eistat_h) : 0; $eistat_b_human = (int) $eistat_day_row->bounces_human; $eistat_b_all = (int) $eistat_day_row->bounces; $eistat_br_human = $eistat_h > 0 ? round($eistat_b_human / $eistat_h * 100, 1) : 0; $eistat_br_all = $eistat_s > 0 ? round($eistat_b_all / $eistat_s * 100, 1) : 0; ?>
unique_visitors)); ?>
(%)

source)); $eistat_avg = $src->s > 0 ? round($src->dur / $src->s) : 0; ?>
source); ?> s)); ?> pv)); ?>

views > 0 ? round($pg->total_time / $pg->views) : 0; ?>
page_url); ?> page_type); ?> views)); ?> unique_views)); ?>

total_time; if ($eistat_dur === 0) { $eistat_dur = min(600, strtotime($sess->last_seen) - strtotime($sess->first_seen)); } $eistat_sess_url = admin_url('admin.php?page=eistat-dashboard&view=session&session=' . $sess->session_hash); ?>
first_seen, 11, 5)); ?> entry_page_url); ?> exit_page_url); ?> unique_pages; ?> pageviews; ?> source); ?> device); ?> is_bot): ?> ()
1): $eistat_base = admin_url('admin.php?page=eistat-dashboard&view=day&date=' . $eistat_date); ?>
>

total_ips)); ?>
repeat_ips)); ?>

⚠