}
     $ip_cidr = empty($sensor_ip) ? $agent['ip'] : $sensor_ip;
 } else {
     $agent_idm_data = Ossec_agent::get_idm_data($sensor_id, $agent['ip']);
     $agent_idm_ip = $agent_idm_data['ip'];
     if (empty($agent_idm_ip)) {
         try {
             $agent_idm_ip = Ossec_agent::get_last_ip($sensor_id, $agent);
         } catch (Exception $e) {
         }
     }
     $ip_cidr = Asset_host_ips::valid_ip($agent_idm_ip) ? $agent_idm_ip : $agent['ip'];
 }
 $data = array();
 if (!preg_match('/Never connected/i', $agent['status']) && Asset_host_ips::valid_ip($ip_cidr)) {
     $data = Ossec_utilities::SIEM_trends_hids($conn, $ip_cidr);
 }
 $trend_plot = "<div style='color:gray; margin:15px; text-align:center;'>" . _('Trend chart not available') . "</div>";
 if (is_array($data) && !empty($data)) {
     $trend = '';
     $max = 7;
     for ($ii = $max - 1; $ii >= 0; $ii--) {
         $d = gmdate("j M", $timetz - 86400 * $ii);
         $trend[$d] = $data[$d] != '' ? $data[$d] : 0;
     }
     $i = 0;
     foreach ($trend as $k => $v) {
         $x[$k] = $i;
         $i++;
     }
     $y = $trend;