$list = "";
         $listKeys = array_keys($list_facilities);
         foreach ($list_facilities as $key => $value) {
             if (strcmp($list, "") != 0) {
                 $list .= ",";
             }
             $list .= "'" . $key . "'";
         }
         array_push($sql_filter, " (facility IN (" . $list . ")) ");
     }
 }
 if (isset($filter_severity)) {
     if (strcmp($filter_Fseverity, "") == 0 || strcmp($filter_Fseverity, "eq") == 0) {
         array_push($sql_filter, " (priority = '" . htmlentities($filter_severity, ENT_QUOTES) . "') ");
     } else {
         $list_priorities = getListOfSeverities($filter_severity, $filter_Fseverity);
         $list = "";
         $listKeys = array_keys($list_priorities);
         foreach ($list_priorities as $key => $value) {
             if (strcmp($list, "") != 0) {
                 $list .= ",";
             }
             $list .= "'" . $key . "'";
         }
         array_push($sql_filter, " (priority IN (" . $list . ")) ");
     }
 }
 if (isset($filter_msg)) {
     array_push($sql_filter, " (msg LIKE '%" . htmlentities($filter_msg, ENT_QUOTES) . "%') ");
 }
 if (isset($StartDate)) {
        $list = "";
        $listKeys = array_keys($list_facilities);
        foreach ($list_facilities as $key => $value) {
            if (strcmp($list, "") != 0) {
                $list .= ",";
            }
            $list .= "'" . $key . "'";
        }
        array_push($sql_filter, " (facility IN (" . $list . ")) ");
    }
}
if (isset($_GET['severity']) && $_GET['severity'] != "" && $_GET['severity'] != "undefined") {
    if (strcmp($Fseverity_selected, "") == 0 || strcmp($Fseverity_selected, "eq") == 0) {
        array_push($sql_filter, " (priority = '" . htmlentities($_GET['severity'], ENT_QUOTES) . "') ");
    } else {
        $list_priorities = getListOfSeverities($_GET['severity'], $Fseverity_selected);
        $list = "";
        $listKeys = array_keys($list_priorities);
        foreach ($list_priorities as $key => $value) {
            if (strcmp($list, "") != 0) {
                $list .= ",";
            }
            $list .= "'" . $key . "'";
        }
        array_push($sql_filter, " (priority IN (" . $list . "))  ");
    }
}
if (isset($_GET['msg']) && $_GET['msg'] != "" && $_GET['msg'] != "undefined") {
    array_push($sql_filter, " (msg LIKE '%" . htmlentities($_GET['msg'], ENT_QUOTES) . "%') ");
}
$req_sql_filter = "";
        $list = "";
        $listKeys = array_keys($list_facilities);
        foreach ($list_facilities as $key => $value) {
            if (strcmp($list, "") != 0) {
                $list .= ",";
            }
            $list .= "'" . $key . "'";
        }
        array_push($sql_filter, " (facility IN (" . $list . "))  ");
    }
}
if (isset($_GET['severity']) && $_GET['severity'] != "") {
    if (strcmp($_GET['Fseverity'], "") == 0 || strcmp($_GET['Fseverity'], "eq") == 0) {
        array_push($sql_filter, " (priority = '" . htmlentities($_GET['severity'], ENT_QUOTES) . "')  ");
    } else {
        $list_severities = getListOfSeverities($_GET['severity'], $_GET['Fseverity']);
        $list = "";
        $listKeys = array_keys($list_severities);
        foreach ($list_severities as $key => $value) {
            if (strcmp($list, "") != 0) {
                $list .= ",";
            }
            $list .= "'" . $key . "'";
        }
        array_push($sql_filter, " (priority IN (" . $list . "))  ");
    }
}
if (isset($_GET['msg']) && $_GET['msg'] != "") {
    array_push($sql_filter, " (msg LIKE '%" . htmlentities($_GET['msg'], ENT_QUOTES) . "%')  ");
}
$req_sql_filter = "";