$CurrPag = 0;
    }
    if ($CurrPag < 0) {
        $CurrPag = 0;
    }
    $postlink = $CurrPag * $PostXPage + 1;
    $db->query("replace temp(chiave,valore,TTL) values ('" . $_REQUEST['THR_ID'] . "',{$Num3d}," . (time() + 2592000) . ");");
    $db->query("update {$SNAME}_msghe set read_num=read_num+1 WHERE HASH='" . mysql_escape_string($MSGID) . "';");
    // *** convertire searcher.pm prima di attivare questa funzione ***
    //echo "<a href=\"searcher.pm?MODO=2&amp;REP_OF=".urlencode($MSGID)."\">";
    //echo $lang['shmsg_findnewmsg']."</a><br />";
    PageSelect(1);
    if ($CurrPag < 1) {
        printmsg($riga, $postlink - 1);
    }
    $query = "SELECT edit.TITLE AS title, edit.BODY AS body, membri.AUTORE as autore, " . " (origi.DATE+" . GMT_TIME . ") as 'date', (membri.DATE+" . GMT_TIME . ") AS regdate, membri.avatar AS avatar, membri.firma AS firma," . " membri.is_auth AS 'is_auth', membri.msg_num AS 'msg_num'," . " membri.title as 'gruppo', membri.HASH AS 'memhash',origi.HASH AS 'hash', edit.REP_OF AS 'repof'," . " edit.EDIT_OF AS 'edit_of', edit.HASH AS 'real_hash', edit.AUTORE AS 'real_autore', (edit.DATE+" . GMT_TIME . ") AS 'real_date'" . " FROM `{$SNAME}_reply` AS origi, `{$SNAME}_reply` AS edit, `{$SNAME}_membri` AS membri\r\n\t   WHERE edit.EDIT_OF=origi.HASH" . " AND membri.HASH=origi.AUTORE" . " AND edit.REP_OF='" . mysql_escape_string($MSGID) . "'" . " AND edit.visibile='1'" . " ORDER BY origi.DATE" . " LIMIT " . $CurrPag * $PostXPage . ",{$PostXPage};";
    $risultato = $db->get_results($query);
    if ($risultato) {
        foreach ($risultato as $riga) {
            printmsg($riga, $postlink);
            $postlink++;
        }
    }
    PageSelect(2);
    FastReply();
}
?>
</td>
</tr>
<?php 
include "end.php";
            $PostStatImage = "f_fixed";
        }
        $rep = $riga->reply_num;
        $i = 0;
        $Pages = "";
        if ($rep > $PostXPage) {
            while ($rep > 0) {
                if ($i <= $Section) {
                    $Pages = $Pages . "<td align='left' nowrap='nowrap'><span class='pagelink'><a href='showmsg.php?SEZID=" . $riga->sez . "&amp;THR_ID=" . $iden['hex'] . "&amp;pag={$i}'>" . ++$i . "</a></span></td>";
                    $rep = $rep - $PostXPage;
                } else {
                    $Pages = $Pages . "<td align='left' nowrap='nowrap'><span class='pagelink'>..</span>&nbsp;<span class='pagelink'><a href='showmsg.php?SEZID=" . $riga->sez . "&amp;THR_ID=" . $iden['hex'] . "&amp;pag=last#end_page'>&raquo;</a></span></td>";
                    $rep = 0;
                }
            }
        }
        if (!trim($riga->title)) {
            $riga->title = "(untitled)";
        }
        if (strlen($riga->title) > 100) {
            $title = substr($riga->title, 0, 100) . "...";
        } else {
            $title = $riga->title;
        }
        echo "\r\n<tr>\r\n  <td align='center' class='row2'><img src='img/{$PostStatImage}.gif' alt=''></td>\r\n  <td align='center' class='row2'>{$post_icon}</td>\r\n  <td align='left' class='row2'><table border='0' cellpadding='2px' cellspacing='0'><tbody><tr><td align='left' nowrap='nowrap'>" . $gotolu . "{$pinned_str}<a href='showmsg.php?SEZID=" . $riga->sez . "&amp;THR_ID=" . $iden['hex'] . "' title='" . $lang['topic_start'] . " {$write_date}'>" . secure_v($title) . "</a>{$pinned_close}</td>" . $Pages . "</tr></tbody></table>&nbsp;" . secure_v($riga->subtitle) . "</td>\r\n  <td align=center class='row4'><a href='sezioni.php?SEZID=" . $riga->sez . "'>" . $sezname[$riga->sez] . "</td>\r\n  <td align=center class='row4'><a href=\"javascript:who_posted('{$iden['hex']}',{$riga->sez})\">" . $riga->reply_num . "</a></td>\r\n  <td align=center class='row4'><small><u><a href='showmember.php?MEM_ID=" . $nickhash['alfa'] . "'>" . secure_v($riga->nick) . "</a></u></small></td>\r\n  <tD align=left class='row4'><small>{$reply_date}<br><a href=\"showmsg.php?SEZID=" . $riga->sez . "&amp;THR_ID=" . $iden['hex'] . "&amp;pag=last#end_page\">" . $lang['topic_last'] . "</a>: <b><a href='showmember.php?MEM_ID=" . $dnickhash['alfa'] . "'>" . secure_v($riga->dnick) . "</a></b></small></tD>\r\n</tr>\n";
    }
}
echo "</table></div>";
echo "</td></tr>";
PageSelect();
include "end.php";