$searchString2 = db_searchMatchGen($whereGenAr[1], $i);
}
if ($searchWhere != 0) {
    unset($searchString2);
}
if (!$word || strlen($searchFor) > 100) {
    $searchResults = '<span class=txtSm>' . $l_search[10] . '</span>';
} else {
    if (!isset($searchResults)) {
        $searchResults = '';
    }
    $i = $viewmaxsearch * $page;
    $and = $extra && !$searchWhere ? 'AND' : 'WHERE';
    $xtrE = $extra == 1 ? getClForums($closedForums, $and, $sTA[$searchWhere], 'forum_id', 'AND', '!=') : '';
    $and = $extra || !$searchWhere ? 'AND' : 'WHERE';
    $xtr = $xtrE . getByDay($and, $sTA[$searchWhere], $sTTA[$searchWhere]) . db_searchWithin($searchWhere, true);
    if (!$searchWhere) {
        $numRows = db_simpleSelect(2, $sCA[$searchWhere], 'count(*)', $Tp . '.topic_id', '=', "{$Tt}.topic_id");
    } else {
        $numRows = db_simpleSelect(2, $sCA[$searchWhere], 'count(*)');
    }
    $pageNav = pageNav($page, $numRows, "{$main_url}/{$indexphp}action=search&amp;searchFor={$searchFor}&amp;searchWhere={$searchWhere}&amp;searchHow={$searchHow}&amp;searchForum={$searchForum}&amp;days={$days}&amp;exact={$exact}&amp;page=", $viewmaxsearch, false);
    $makeLim = makeLim($page, $numRows, $viewmaxsearch);
    $xtr = str_replace('WHERE', 'AND', $xtr);
    if ($searchWhere == 0 && $numRows) {
        $xtr .= db_searchWithin($searchWhere, false);
        $cols = db_simpleSelect(0, $Tp . ',' . $Tt . ',' . $Tf, "{$Tp}.post_id, {$Tp}.forum_id, {$Tp}.topic_id, {$Tp}.post_text, {$Tp}.post_time, {$Tt}.topic_title, {$Tf}.forum_name", '', '', '', 'post_id DESC', $makeLim, $Tp . '.topic_id', '=', $Tt . '.topic_id', false);
        do {
            $i++;
            $forum = $cols[1];
            $topic = $cols[2];
$makeLim = fTopa($top);
$statsOptL = array($l_stats_popular, $l_stats_aUsers, $l_stats_viewed);
for ($i = 0; $i <= $lstLim; $i++) {
    if ($i != $lst) {
        $statsOpt .= ' / <b><a href="' . $indexphp . 'action=stats&amp;top=' . $top . '&amp;days=' . $days . '&amp;lst=' . $i . '">' . $statsOptL[$i] . '</a></b>';
    } else {
        $statsOpt .= ' / <b>' . $statsOptL[$i] . '</b>';
    }
}
$tpl = makeUp('stats_bar');
if ($lst == 0) {
    $xtr = $extra == 1 ? getClForums($closedForums, 'AND', $Tp, 'forum_id', 'AND', '!=') : '';
    $xtr .= getByDay('AND', $Tp, 'post_time');
} elseif ($enableViews && $lst == 2) {
    $xtr = $extra == 1 ? getClForums($closedForums, 'AND', $Tt, 'forum_id', 'AND', '!=') : '';
    $xtr .= getByDay('AND', $Tt, 'topic_time');
}
if ($lst == 0 && ($cols = db_simpleSelect(0, "{$Tt},{$Tp}", "{$Tt}.topic_id, {$Tt}.topic_title, {$Tt}.forum_id, {$Tt}.posts_count as cnt", '', '', '', 'cnt DESC', $makeLim, "{$Tt}.topic_id", '=', "{$Tp}.topic_id", false, "{$Tp}.topic_id"))) {
    do {
        if ($cols[3]) {
            $val = $cols[3] - 1;
            if (!isset($vMax)) {
                $vMax = $val;
            }
            if ($vMax != 0) {
                $stats_barWidth = round(100 * ($val / $vMax));
            }
            if ($stats_barWidth > $stats_barWidthLim) {
                $key = '<a href="' . $indexphp . 'action=vthread&amp;forum=' . $cols[2] . '&amp;topic=' . $cols[0] . '">' . $cols[1] . '</a>';
            } else {
                $key2 = '<a href="' . $indexphp . 'action=vthread&amp;forum=' . $cols[2] . '&amp;topic=' . $cols[0] . '">' . $cols[1] . '</a>';