function mactrack_display_stats()
{
    global $colors;
    /* check if scanning is running */
    $processes = db_fetch_cell("SELECT COUNT(*) FROM mac_track_processes");
    $frequency = read_config_option("mt_collection_timing", TRUE) * 60;
    $mactrack_stats = read_config_option("stats_mactrack", TRUE);
    $time = 'Not Recorded';
    $proc = 'N/A';
    $devs = 'N/A';
    if ($mactrack_stats != '') {
        $stats = explode(" ", $mactrack_stats);
        if (sizeof($stats == 3)) {
            $time = explode(":", $stats[0]);
            $time = $time[1];
            $proc = explode(":", $stats[1]);
            $proc = $proc[1];
            $devs = explode(":", $stats[2]);
            $devs = $devs[1];
        }
    }
    if ($processes > 0) {
        $message = "<strong>Status:</strong> Running, <strong>Processes:</strong> " . $processes . ", <strong>Progress:</strong> " . read_config_option("mactrack_process_status", TRUE) . ", <strong>LastRuntime:</strong> " . round($time, 1);
    } else {
        $message = "<strong>Status:</strong> Idle, <strong>LastRuntime:</strong> " . round($time, 1) . " seconds, <strong>Processes:</strong> " . $proc . " processes, <strong>Devices:</strong> " . $devs . ", <strong>Next Run Time:</strong> " . date("Y-m-d H:i:s", strtotime(read_config_option("mt_scan_date", TRUE)) + $frequency);
    }
    html_start_box("", "100%", $colors["header"], "3", "center", "");
    print "<tr>";
    print "<td><strong>Scanning Rate:</strong> Every " . mactrack_display_hours(read_config_option("mt_collection_timing")) . ", " . $message . "</td>";
    print "</tr>";
    html_end_box();
}
function mactrack_display_stats()
{
    /* check if scanning is running */
    $processes = db_fetch_cell('SELECT COUNT(*) FROM mac_track_processes');
    $frequency = read_config_option('mt_collection_timing', TRUE) * 60;
    $mactrack_stats = read_config_option('stats_mactrack', TRUE);
    $time = __('Not Recorded');
    $proc = __('N/A');
    $devs = __('N/A');
    if ($mactrack_stats != '') {
        $stats = explode(' ', $mactrack_stats);
        if (sizeof($stats == 3)) {
            $time = explode(':', $stats[0]);
            $time = $time[1];
            $proc = explode(':', $stats[1]);
            $proc = $proc[1];
            $devs = explode(':', $stats[2]);
            $devs = $devs[1];
        }
    }
    if ($processes > 0) {
        $message = __('Status: Running, Processes: %d, Progress: %s, LastRuntime: %f', $processes, read_config_option('mactrack_process_status', TRUE), round($time, 1));
    } else {
        $message = __('Status: Idle, LastRuntime: %f seconds, Processes: %d processes, Devices: %d, Next Run Time: %s', round($time, 1), $proc, $devs, date('Y-m-d H:i:s', strtotime(read_config_option('mt_scan_date', TRUE)) + $frequency));
    }
    html_start_box('', '100%', '', '3', 'center', '');
    print '<tr>';
    print '<td>' . __('Scanning Rate: Every %s', mactrack_display_hours(read_config_option('mt_collection_timing'))) . ', ' . $message . '</td>';
    print '</tr>';
    html_end_box();
}