public static function show_spy_view($_id = 'p0', $_type = 'undefined')
 {
     $results = !is_int($_type) ? wp_slimstat_db::get_recent('t1.id', '(t1.visit_id > 0 AND tb.type <> 1)', 'tb.browser, tb.version, tb.platform, tb.type, tb.user_agent', '', 't1.visit_id DESC') : wp_slimstat_db::get_recent_outbound($_type);
     if (count($results) == 0) {
         echo '<p class="nodata">' . __('No data to display', 'wp-slimstat') . '</p>';
         return true;
     }
     $visit_id = 0;
     for ($i = 0; $i < count($results); $i++) {
         $row_details = '';
         $results[$i]['ip'] = long2ip($results[$i]['ip']);
         $host_by_ip = $results[$i]['ip'];
         if (wp_slimstat::$options['convert_ip_addresses'] == 'yes') {
             $host_by_ip = gethostbyaddr($results[$i]['ip']);
             $host_by_ip .= $host_by_ip != $results[$i]['ip'] ? " ({$results[$i]['ip']})" : '';
         }
         $results[$i]['dt'] = date_i18n(wp_slimstat_db::$formats['date_time_format'], $results[$i]['dt'], true);
         if (!empty($results[$i]['searchterms']) && empty($results[$i]['resource'])) {
             $results[$i]['resource'] = __('Search for', 'wp-slimstat') . ': ' . htmlentities($results[$i]['searchterms'], ENT_QUOTES, 'UTF-8');
         }
         if (!empty($results[$i]['resource']) && $_type == 0) {
             $base_url = '';
             if (!empty($results[$i]['blog_id'])) {
                 $base_url = parse_url(get_site_url($results[$i]['blog_id']));
                 $base_url = $base_url['scheme'] . '://' . $base_url['host'];
             }
             $results[$i]['resource'] = '<a target="_blank" class="url" title="' . __('Open this URL in a new window', 'wp-slimstat') . '" href="' . $base_url . htmlentities($results[$i]['resource'], ENT_QUOTES, 'UTF-8') . '"></a> ' . $base_url . self::get_resource_title($results[$i]['resource']);
         }
         if ($visit_id != $results[$i]['visit_id']) {
             $highlight_row = !empty($results[$i]['searchterms']) ? ' is-search-engine' : ' is-direct';
             if (empty($results[$i]['user'])) {
                 $host_by_ip = "<a class='slimstat-filter-link' href='" . self::fs_url('ip equals ' . $results[$i]['ip']) . "'>{$host_by_ip}</a>";
             } else {
                 $display_user_name = $results[$i]['user'];
                 if (wp_slimstat::$options['show_display_name'] == 'yes' && strpos($results[$i]['notes'], 'user:'******'login', $results[$i]['user']);
                     if (is_object($display_real_name)) {
                         $display_user_name = $display_real_name->display_name;
                     }
                 }
                 $host_by_ip = "<a class='slimstat-filter-link highlight-user' href='" . self::fs_url('user equals ' . $results[$i]['user']) . "'>{$display_user_name}</a>";
                 $highlight_row = strpos($results[$i]['notes'], '[user]') !== false ? ' is-known-user' : ' is-known-visitor';
             }
             $host_by_ip = "<a class='slimstat-font-location-1 whois' href='" . wp_slimstat::$options['ip_lookup_service'] . "{$results[$i]['ip']}' target='_blank' title='WHOIS: {$results[$i]['ip']}'></a> {$host_by_ip}";
             $results[$i]['country'] = "<a class='slimstat-filter-link inline-icon' href='" . self::fs_url('country equals ' . $results[$i]['country']) . "'><img class='slimstat-tooltip-trigger' src='" . plugins_url('/images/flags/' . $results[$i]['country'] . '.png', dirname(__FILE__)) . "' width='16' height='16'/><span class='slimstat-tooltip-content'>" . __('c-' . $results[$i]['country'], 'wp-slimstat') . '</span></a>';
             $results[$i]['other_ip'] = !empty($results[$i]['other_ip']) ? " <a class='slimstat-filter-link' href='" . self::fs_url('other_ip equals ' . $results[$i]['other_ip']) . "'>" . long2ip($results[$i]['other_ip']) . '</a>&nbsp;&nbsp;' : '';
             echo "<p class='header{$highlight_row}'>{$results[$i]['country']} {$host_by_ip} <span class='date-and-other'><em>{$results[$i]['other_ip']} {$results[$i]['dt']}</em></span></p>";
             $visit_id = $results[$i]['visit_id'];
         }
         if (!empty($results[$i]['domain'])) {
             if (!is_int($_type)) {
                 $element_url = htmlentities(strpos($results[$i]['referer'], '://') == false ? "http://{$results[$i]['domain']}{$results[$i]['referer']}" : $results[$i]['referer'], ENT_QUOTES, 'UTF-8');
                 $row_details = __('Source', 'wp-slimstat') . ": <a class='slimstat-filter-link' href='" . self::fs_url('domain equals ' . $results[$i]['domain']) . "'>{$results[$i]['domain']}</a>";
                 if (!empty($results[$i]['searchterms'])) {
                     $row_details .= "<br>" . __('Keywords', 'wp-slimstat') . ": ";
                     $row_details .= self::get_search_terms_info($results[$i]['searchterms'], $results[$i]['domain'], $results[$i]['referer'], true);
                 }
             } else {
                 $permalink = parse_url($results[$i]['referer']);
                 $results[$i]['notes'] = str_replace('|ET:click', '', $results[$i]['notes']);
                 $element_url = htmlentities(strpos($results[$i]['referer'], '://') === false ? home_url() . $results[$i]['referer'] : $results[$i]['referer'], ENT_QUOTES, 'UTF-8');
                 $row_details = __('Source', 'wp-slimstat') . ": <a target=\"_blank\" class=\"url\" title=\"" . __('Open this URL in a new window', 'wp-slimstat') . "\" href=\"{$element_url}\"></a><a class=\"slimstat-filter-link\" title=\"" . htmlentities(sprintf(__('Filter results where resource equals %s', 'wp-slimstat'), $permalink['path']), ENT_QUOTES, 'UTF-8') . "\" href=\"" . self::fs_url('resource equals ' . $permalink['path']) . "\">{$permalink['path']}</a>";
                 $row_details .= !empty($results[$i]['notes']) ? '<br><strong>Link Details</strong>: ' . htmlentities($results[$i]['notes'], ENT_QUOTES, 'UTF-8') : '';
                 $row_details .= $_type == -1 ? ' <strong>Type</strong>: ' . $results[$i]['type'] : '';
             }
         }
         if (!empty($row_details)) {
             $is_expanded = wp_slimstat::$options['expand_details'] == 'yes' ? ' expanded' : '';
             $row_details = "<b class='slimstat-row-details{$is_expanded}'>{$row_details}</b>";
         }
         echo "<p>{$results[$i]['resource']} {$row_details}</p>";
     }
 }