$log_record['user_name'] = tr('cog_user_name');
             $log_record['user_id'] = 0;
         }
         // koniec ukrywania nicka autora komentarza COG
         $file_content .= '<b>' . $log_record['user_name'] . '</b>: &nbsp;';
         if ($log_record['encrypt'] == 1 && $log_record['cache_owner'] != $usr['userid'] && $log_record['luser_id'] != $usr['userid']) {
             $file_content .= "<img src=\\'/tpl/stdstyle/images/free_icons/lock.png\\' alt=\\`\\` /><br/>";
         }
         if ($log_record['encrypt'] == 1 && ($log_record['cache_owner'] == $usr['userid'] || $log_record['luser_id'] == $usr['userid'])) {
             $file_content .= "<img src=\\'/tpl/stdstyle/images/free_icons/lock_open.png\\' alt=\\`\\` /><br/>";
         }
         $data = cleanup_text(str_replace("\r\n", " ", $log_record['log_text']));
         $data = str_replace("\n", " ", $data);
         if ($log_record['encrypt'] == 1 && $log_record['cache_owner'] != $usr['userid'] && $log_record['luser_id'] != $usr['userid']) {
             //crypt the log ROT13, but keep HTML-Tags and Entities
             $data = str_rot13_html($data);
         } else {
             $file_content .= "<br/>";
         }
         $file_content .= $data;
         $file_content .= '\', PADDING,5, WIDTH,280,SHADOW,true)" onmouseout="UnTip()">' . htmlspecialchars($log_record['cache_name'], ENT_COMPAT, 'UTF-8') . '</a></b></td>';
         $file_content .= '<td><b><a class="links" href="viewprofile.php?userid=' . htmlspecialchars($log_record['user_id'], ENT_COMPAT, 'UTF-8') . '">' . htmlspecialchars($log_record['user_name'], ENT_COMPAT, 'UTF-8') . '</a></b></td>';
         $file_content .= "</tr>";
     }
 }
 $pages = mb_ereg_replace('{last_img}', $last_img, $pages);
 $pages = mb_ereg_replace('{first_img}', $first_img, $pages);
 $pages = mb_ereg_replace('{first_img_inactive}', $first_img_inactive, $pages);
 $pages = mb_ereg_replace('{last_img_inactive}', $last_img_inactive, $pages);
 tpl_set_var('file_content', $file_content);
 tpl_set_var('pages', $pages);
             // koniec ukrywania nicka autora komentarza COG
             $tmp_log = mb_ereg_replace('{userid}', htmlspecialchars($record_logs['user_id'], ENT_COMPAT, 'UTF-8'), $tmp_log);
             $tmp_log = mb_ereg_replace('{username}', htmlspecialchars($record_logs['user_name'], ENT_COMPAT, 'UTF-8'), $tmp_log);
             $tmp_log = mb_ereg_replace('{logid}', htmlspecialchars(urlencode($record_logs['id']), ENT_COMPAT, 'UTF-8'), $tmp_log);
             $logtext = '<b>' . $record_logs['user_name'] . '</b>: &nbsp;';
             if ($record_logs['encrypt'] == 1 && $record_logs['cache_owner'] != $usr['userid'] && $record_logs['luser_id'] != $usr['userid']) {
                 $logtext .= "<img src=\\'/tpl/stdstyle/images/free_icons/lock.png\\' alt=\\`\\` /><br/>";
             }
             if ($record_logs['encrypt'] == 1 && ($record_logs['cache_owner'] == $usr['userid'] || $record_logs['luser_id'] == $usr['userid'])) {
                 $logtext .= "<img src=\\'/tpl/stdstyle/images/free_icons/lock_open.png\\' alt=\\`\\` /><br/>";
             }
             $data_text = common::cleanupText(str_replace("\r\n", " ", $record_logs['log_text']));
             $data_text = str_replace("\n", " ", $data_text);
             if ($record_logs['encrypt'] == 1 && $record_logs['cache_owner'] != $usr['userid'] && $record_logs['luser_id'] != $usr['userid']) {
                 //crypt the log ROT13, but keep HTML-Tags and Entities
                 $data_text = str_rot13_html($data_text);
             } else {
                 $logtext .= "<br/>";
             }
             $logtext .= $data_text;
             $tmp_log = mb_ereg_replace('{logtext}', $logtext, $tmp_log);
             $content .= "\n" . $tmp_log;
         }
         mysql_free_result($rs_logs);
         $content .= '</ul></div><br />';
     }
 }
 //  ----------------- begin  owner section  ----------------------------------
 if ($user_id == $usr['userid'] || $usr['admin']) {
     $rscheck = sqlValue("SELECT count(*) FROM caches WHERE (status = 4 OR status = 5 OR status = 6) AND `user_id`='" . sql_escape($_REQUEST['userid']) . "'", 0);
     if ($rscheck != 0) {
 $lat = sprintf('%01.5f', $r['latitude']);
 $thisline = str_replace('{lat}', help_latToDegreeStr($lat), $thisline);
 $thisline = str_replace('{latraw}', $r['latitude'], $thisline);
 $lon = sprintf('%01.5f', $r['longitude']);
 $thisline = str_replace('{lon}', help_lonToDegreeStr($lon), $thisline);
 $thisline = str_replace('{lonraw}', $r['longitude'], $thisline);
 $time = date('d.m.Y', strtotime($r['date_hidden']));
 $thisline = str_replace('{time}', $time, $thisline);
 $thisline = str_replace('{waypoint}', $r['waypoint'], $thisline);
 $thisline = str_replace('{cacheid}', $r['cacheid'], $thisline);
 $thisline = str_replace('{cachename}', filterevilchars($r['name']), $thisline);
 $thisline = str_replace('{country}', $r['country'], $thisline);
 if ($r['hint'] == '') {
     $thisline = str_replace('{hints}', '', $thisline);
 } else {
     $thisline = str_replace('{hints}', str_rot13_html(filterevilchars(strip_tags($r['hint']))), $thisline);
 }
 if ($r['html'] == 0) {
     $thisline = str_replace('{desc}', filterevilchars(strip_tags($r['desc'])), $thisline);
 } else {
     $thisline = str_replace('{desc}', html2txt(filterevilchars($r['desc'])), $thisline);
 }
 $thisline = str_replace('{type}', $r['type'], $thisline);
 $thisline = str_replace('{typeid}', $r['typeid'], $thisline);
 $thisline = str_replace('{container}', $r['size'], $thisline);
 $thisline = str_replace('{sizeid}', $r['sizeid'], $thisline);
 $thisline = str_replace('{status}', $r['status'], $thisline);
 $thisline = str_replace('{statusid}', $r['statusid'], $thisline);
 $difficulty = sprintf('%01.1f', $r['difficulty'] / 2);
 $thisline = str_replace('{difficulty}', $difficulty, $thisline);
 $terrain = sprintf('%01.1f', $r['terrain'] / 2);
while ($r = sql_fetch_array($rs)) {
    $thisline = $txtLine;
    $lat = sprintf('%01.5f', $r['latitude']);
    $thisline = mb_ereg_replace('{lat}', help_latToDegreeStr($lat), $thisline);
    $lon = sprintf('%01.5f', $r['longitude']);
    $thisline = mb_ereg_replace('{lon}', help_lonToDegreeStr($lon), $thisline);
    $time = date('d.m.Y', strtotime($r['date_hidden']));
    $thisline = mb_ereg_replace('{time}', $time, $thisline);
    $thisline = mb_ereg_replace('{waypoint}', $r['waypoint'], $thisline);
    $thisline = mb_ereg_replace('{cacheid}', $r['cacheid'], $thisline);
    $thisline = mb_ereg_replace('{cachename}', $r['name'], $thisline);
    $thisline = mb_ereg_replace('{country}', db_CountryFromShort($r['country']), $thisline);
    if ($r['hint'] == '') {
        $thisline = mb_ereg_replace('{hints}', '', $thisline);
    } else {
        $thisline = mb_ereg_replace('{hints}', str_rot13_html(strip_tags($r['hint'])), $thisline);
    }
    $thisline = mb_ereg_replace('{shortdesc}', $r['short_desc'], $thisline);
    if ($r['html'] == 0) {
        $thisline = mb_ereg_replace('{htmlwarn}', '', $thisline);
        $thisline = mb_ereg_replace('{desc}', strip_tags($r['desc']), $thisline);
    } else {
        $thisline = mb_ereg_replace('{htmlwarn}', ' (Vorsicht, aus HTML konvertiert)', $thisline);
        $thisline = mb_ereg_replace('{desc}', html2txt($r['desc']), $thisline);
    }
    $thisline = mb_ereg_replace('{type}', $r['type'], $thisline);
    $thisline = mb_ereg_replace('{container}', $r['size'], $thisline);
    $thisline = mb_ereg_replace('{status}', $r['status'], $thisline);
    $difficulty = sprintf('%01.1f', $r['difficulty'] / 2);
    $thisline = mb_ereg_replace('{difficulty}', $difficulty, $thisline);
    $terrain = sprintf('%01.1f', $r['terrain'] / 2);
 } else {
     //hind avaiable, user logged - proceed with hint
     tpl_set_var('hidehint_start', '');
     tpl_set_var('hidehint_end', '');
     tpl_set_var('decrypt_icon', $decrypt_icon);
     tpl_set_var('decrypt_table', $decrypt_table);
     if ($no_crypt == 0) {
         $link = mb_ereg_replace('{cacheid_urlencode}', htmlspecialchars(urlencode($cache_id), ENT_COMPAT, 'UTF-8'), $decrypt_link);
         $link = mb_ereg_replace('{desclang}', htmlspecialchars(urlencode($desclang), ENT_COMPAT, 'UTF-8'), $link);
         tpl_set_var('decrypt_link', $link);
         tpl_set_var("decrypt_link_start", '');
         tpl_set_var("decrypt_link_end", '');
         tpl_set_var("decrypt_table_start", '');
         tpl_set_var("decrypt_table_end", '');
         //crypt the hint ROT13, but keep HTML-Tags and Entities
         $hint = str_rot13_html($hint);
         //TODO: mark all that isn't ROT13 coded
     } else {
         $cryptedhints = mb_ereg_replace('{decrypt_link}', '', $cryptedhints);
         tpl_set_var("decrypt_link_start", "<!--");
         tpl_set_var("decrypt_link_end", "-->");
         tpl_set_var("decrypt_table_start", "<!--");
         tpl_set_var("decrypt_table_end", "-->");
     }
     //replace { and } to prevent replacing
     $hint = mb_ereg_replace('{', '&#0123;', $hint);
     $hint = mb_ereg_replace('}', '&#0125;', $hint);
     tpl_set_var('hints', $hint);
 }
 //check number of pictures in logs
 $rspiclogs = sqlValue("SELECT COUNT(*) FROM `pictures`,`cache_logs` WHERE `pictures`.`object_id`=`cache_logs`.`id` AND `pictures`.`object_type`=1 AND `cache_logs`.`cache_id`= " . addslashes($cache_id), 0);