diff --git a/engine/data.inc.php b/engine/data.inc.php
index e3e6fd3..e7d3630 100644
--- a/engine/data.inc.php
+++ b/engine/data.inc.php
@@ -216,6 +216,8 @@ function baw_get_library($file, $data) {
         '<a href="',
         '&',
         '/" Searc',
+        '[',
+        ']'
     );
     $replace  = array(
         "\$LogType = 'S'",
@@ -232,7 +234,9 @@ function baw_get_library($file, $data) {
         " ",
         '<a class="ext_link" href="',
         '&amp;',
-        '/" title="Searc'
+        '/" title="Searc',
+        'array(',
+        ')'
     );
     $file_text = str_replace($search, $replace, $file_text);
 
diff --git a/engine/library.inc.php b/engine/library.inc.php
index f91b7ef..43985e3 100644
--- a/engine/library.inc.php
+++ b/engine/library.inc.php
@@ -112,12 +112,28 @@ list (
         array('WormsHashLib', 'WormsHashTarget')
 );
 list (
-    $BAW_LIB['files']['types'],
-    $BAW_LIB['files']['icons'],
-    $BAW_LIB['files']['family']) = baw_get_library (
+    $mime_hash_lib,
+    $mime_hash_icon,
+    $mime_hash_family) = baw_get_library (
         "/mime.pm",
         array('MimeHashLib', 'MimeHashIcon', 'MimeHashFamily')
-);
+        );
+// In the 7.x version of AWStats the meanings of the mime arrays is
+// different from the 6.x versions
+if (count($mime_hash_icon) == 0) {
+    // This is the 7.x version of AWStats
+    $BAW_LIB['files']['types'] = $mime_hash_family;
+    foreach ($mime_hash_lib as $ext => $family_type) {
+        $BAW_LIB['files']['family'][$ext] = $family_type[0];
+    }
+    $BAW_LIB['files']['icons'] = $BAW_LIB['files']['family'];
+} 
+else {
+    // This is the 6.x version of AWStats
+    $BAW_LIB['files']['types'] = $mime_hash_lib;
+    $BAW_LIB['files']['icons'] = $mime_hash_icon;
+    $BAW_LIB['files']['family'] = $mime_hash_family;
+}
 $BAW_LIB['browser']['familes'] = array('msie'=>1,'firefox'=>2,'netscape'=>3,'svn'=>4);
 list (
     $BAW_LIB['browser']['names'],
