Index: extensions/AStat/admin/astat_by_ip.tpl
===================================================================
--- extensions/AStat/admin/astat_by_ip.tpl	(revision 3706)
+++ extensions/AStat/admin/astat_by_ip.tpl	(revision 3707)
@@ -10,5 +10,5 @@
     {foreach from=$datarows key=name item=data}
       <tr class="StatTableRow">
-        <td style="white-space: nowrap"><a href="">{$data.ASTAT_IP_BLACKLIST} {$data.ASTAT_IP_GEOLOCALISATION} {$data.ASTAT_IP_ADRESS}</td>
+        <td style="white-space: nowrap">{$data.ASTAT_IP_BLACKLIST} {$data.ASTAT_IP_GEOLOCALISATION} {$data.ASTAT_IP_ADRESS}</td>
         <td class="number">{$data.PAGES}</td>
         <td class="number">{$data.PICTURES}</td>
Index: extensions/AStat/admin/astat_config.tpl
===================================================================
--- extensions/AStat/admin/astat_config.tpl	(revision 3706)
+++ extensions/AStat/admin/astat_config.tpl	(revision 3707)
@@ -307,4 +307,12 @@
         </td>
       </tr>
+      <tr>
+        <td>&nbsp;</td>
+        <td colspan="2">
+          <select name="f_AStat_UseBlackList">
+            {html_options values=$AStat_enableddisabled_list_values output=$AStat_enableddisabled_list_labels selected=$datas.AStat_UseBlackList_selected}
+          </select>
+        </td>
+      </tr>
 
 
Index: extensions/AStat/astat_aim.class.inc.php
===================================================================
--- extensions/AStat/astat_aim.class.inc.php	(revision 3706)
+++ extensions/AStat/astat_aim.class.inc.php	(revision 3707)
@@ -62,5 +62,6 @@
       'AStat_DefaultSortIP' => 'page',    //page, ip, picture
       'AStat_SeeTimeRequests' => 'false',
-      'AStat_BlackListedIP' => ''    // ip blacklisted (separator : ",")
+      'AStat_BlackListedIP' => '',    // ip blacklisted (separator : ",")
+      'AStat_UseBlackList' => 'false'    // if false, blacklist usage is disabled, if "invert" then result are inverted
       );
 
Index: extensions/AStat/astat_aip.class.inc.php
===================================================================
--- extensions/AStat/astat_aip.class.inc.php	(revision 3706)
+++ extensions/AStat/astat_aip.class.inc.php	(revision 3707)
@@ -420,8 +420,9 @@
     }
 
-    if($this->my_config['AStat_BlackListedIP']!="")
+    if(($this->my_config['AStat_UseBlackList']!="false")&&($this->my_config['AStat_BlackListedIP']!=""))
     {
       ($sql_where=="")?$sql_where=" where ":$sql_where.=" AND ";
-      $sql_where .= " NOT ".$this->make_IP_where_clause($this->my_config['AStat_BlackListedIP']);
+      ($this->my_config['AStat_UseBlackList']=="true")?$sql_where .= " NOT ":"";
+      $sql_where .= $this->make_IP_where_clause($this->my_config['AStat_BlackListedIP']);
     }
 
@@ -498,8 +499,27 @@
     }
 
-    if($this->my_config['AStat_BlackListedIP']!="")
+    if(($this->my_config['AStat_UseBlackList']!="false")&&($this->my_config['AStat_BlackListedIP']!=""))
     {
       ($sql_where=="")?$sql_where=" where ":$sql_where.=" AND ";
-      $sql_where .= " NOT ".$this->make_IP_where_clause($this->my_config['AStat_BlackListedIP']);
+      ($this->my_config['AStat_UseBlackList']=="true")?$sql_where .= " NOT ":"";
+      $sql_where .= $this->make_IP_where_clause($this->my_config['AStat_BlackListedIP']);
+      $sql.=" , 'N' AS blacklist";
+    }
+    else
+    {
+      if($this->my_config['AStat_BlackListedIP']=='')
+      {
+        $sql.=" , 'N' AS blacklist";
+      }
+      else
+      {
+        $sql.=" , (CASE ";
+        $tmp=explode(',', $this->my_config['AStat_BlackListedIP']);
+        foreach($tmp as $key=>$val)
+        {
+          $sql.=" WHEN IP LIKE '".$val."' THEN 'Y' ";
+        }
+        $sql.="ELSE 'N' END) AS blacklist ";
+      }
     }
 
@@ -508,4 +528,5 @@
             from ".HISTORY_TABLE." LEFT JOIN ".USERS_TABLE." ON ".HISTORY_TABLE.".user_id = ".USERS_TABLE.".id ".$sql_where.$sql_group.") as n) as n ";
     $sql=$sql_select.$sql.$sql_nfomax.$sql_from.$sql_max.$sql_where.$sql_group.$sql_order.$sql_limit;
+
 
     $result = pwg_query($sql);
@@ -605,7 +626,8 @@
     $sql_where .= "  ic2.catid = ".HISTORY_TABLE.".category_id ";
 
-    if($this->my_config['AStat_BlackListedIP']!="")
-    {
-      $sql_where .= " AND NOT ".$this->make_IP_where_clause($this->my_config['AStat_BlackListedIP']);
+    if(($this->my_config['AStat_UseBlackList']!="false")&&($this->my_config['AStat_BlackListedIP']!=""))
+    {
+      ($this->my_config['AStat_UseBlackList']=="true")?$sql_where .= " NOT ":"";
+      $sql_where .= $this->make_IP_where_clause($this->my_config['AStat_BlackListedIP']);
     }
 
@@ -700,8 +722,9 @@
     }
 
-    if($this->my_config['AStat_BlackListedIP']!="")
+    if(($this->my_config['AStat_UseBlackList']!="false")&&($this->my_config['AStat_BlackListedIP']!=""))
     {
       ($sql_where=="")?$sql_where=" where ":$sql_where.=" AND ";
-      $sql_where .= " NOT ".$this->make_IP_where_clause($this->my_config['AStat_BlackListedIP']);
+      ($this->my_config['AStat_UseBlackList']=="true")?$sql_where .= " NOT ":"";
+      $sql_where .= $this->make_IP_where_clause($this->my_config['AStat_BlackListedIP']);
     }
 
@@ -1046,5 +1069,12 @@
         }
 
-        $ip_blacklist=$this->format_link("[".l10n('AStat_IP_blacklist')."]", $ip_blacklist);
+        if($stats[$i]["blacklist"]=='Y')
+        {
+          $ip_blacklist="[".l10n('AStat_IP_blacklist')."]";
+        }
+        else
+        {
+          $ip_blacklist=$this->format_link("[".l10n('AStat_IP_blacklist')."]", $ip_blacklist);
+        }
       }
       else
@@ -1471,4 +1501,5 @@
     $template_datas['AStat_showthumbcat_selected']=$this->my_config['AStat_ShowThumbCat'];
     $template_datas['AStat_showthumbimg_selected']=$this->my_config['AStat_ShowThumbImg'];
+    $template_datas['AStat_UseBlackList_selected']=$this->my_config['AStat_UseBlackList'];
 
     // making lists zones
@@ -1507,4 +1538,11 @@
     $template_list_values['yesno'][]='false';
     $template_list_labels['yesno'][]=l10n('AStat_yesno_false');
+
+    $template_list_values['enableddisabled'][]='true';
+    $template_list_values['enableddisabled'][]='false';
+    $template_list_values['enableddisabled'][]='invert';
+    $template_list_labels['enableddisabled'][]=l10n('AStat_enableddisabled_true');
+    $template_list_labels['enableddisabled'][]=l10n('AStat_enableddisabled_false');
+    $template_list_labels['enableddisabled'][]=l10n('AStat_enableddisabled_invert');
 
     $template_datas["L_STAT_TITLE"]=l10n('AStat_config_title');
@@ -1521,4 +1559,6 @@
     $template->assign("AStat_yesno_list_values", $template_list_values['yesno']);
     $template->assign("AStat_yesno_list_labels", $template_list_labels['yesno']);
+    $template->assign("AStat_enableddisabled_list_values", $template_list_values['enableddisabled']);
+    $template->assign("AStat_enableddisabled_list_labels", $template_list_labels['enableddisabled']);
 
     $template->assign_var_from_handle('ASTAT_BODY_PAGE', 'body_page');
@@ -2406,4 +2446,5 @@
   }
 
+
   /* ---------------------------------------------------------------------------
    * AJAX functions
Index: extensions/AStat/language/en_UK/plugin.lang.php
===================================================================
--- extensions/AStat/language/en_UK/plugin.lang.php	(revision 3706)
+++ extensions/AStat/language/en_UK/plugin.lang.php	(revision 3707)
@@ -210,4 +210,8 @@
 $lang['AStat_tools_purge_history_ipid0'] = "To purge events associated with IP from the blacklist (%s items in the blacklist, %s events in history)"
 $lang['AStat_IP_blacklist'] = "Add to the blacklist";
+$lang['AStat_enableddisabled_true'] = "Filter enabled";
+$lang['AStat_enableddisabled_false'] = "Filter disabled";
+$lang['AStat_enableddisabled_invert'] = "Filtre inverted";
+
 
 ?>
Index: extensions/AStat/language/es_ES/plugin.lang.php
===================================================================
--- extensions/AStat/language/es_ES/plugin.lang.php	(revision 3706)
+++ extensions/AStat/language/es_ES/plugin.lang.php	(revision 3707)
@@ -211,3 +211,8 @@
 $lang['AStat_tools_purge_history_ipid0'] = "Para purgar los acontecimientos asociados con la IP de la lista negra (%s elementos en la lista negra, %s acontecimientos en la reseña histórica)";
 $lang['AStat_IP_blacklist'] = "Poner en lista negra";
+$lang['AStat_enableddisabled_true'] = "Filtro activado";
+$lang['AStat_enableddisabled_false'] = "Filtro discapacitados";
+$lang['AStat_enableddisabled_invert'] = "Filtro invertida";
+
+
 ?>
Index: extensions/AStat/language/fr_FR/plugin.lang.php
===================================================================
--- extensions/AStat/language/fr_FR/plugin.lang.php	(revision 3706)
+++ extensions/AStat/language/fr_FR/plugin.lang.php	(revision 3707)
@@ -211,4 +211,8 @@
 $lang['AStat_tools_purge_history_ipid0'] = "Purger les évènements associés aux IP de la liste noire (%s éléments dans la liste noire, %s évènements dans l'historique)";
 $lang['AStat_IP_blacklist'] = "Mettre sur liste noire";
+$lang['AStat_IP_blacklist'] = "Mettre sur liste noire";
+$lang['AStat_enableddisabled_true'] = "Filtre activé";
+$lang['AStat_enableddisabled_false'] = "Filtre désactivé";
+$lang['AStat_enableddisabled_invert'] = "Filtre inversé";
 
 ?>
