diff --git a/pathologic.module b/pathologic.module
index ee64598..22cf926 100644
--- a/pathologic.module
+++ b/pathologic.module
@@ -137,6 +137,10 @@ function _pathologic_filter($text, $filter, $format, $langcode, $cache, $cache_i
       $filter_settings['local_paths'] = variable_get('pathologic_local_paths', '');
     }
     $filter_settings['local_paths_exploded'] = array();
+    $currentPath = array('path' => $base_url_parts['path']);
+    $currentPathAdded = FALSE;
+    $currentHostPath = $currentPath + array('host' => $base_url_parts['host']);
+    $currentHostPathAdded = FALSE;
     if ($filter_settings['local_paths'] !== '') {
       // Build an array of the exploded local paths for this format's settings.
       // array_filter() below is filtering out items from the array which equal
@@ -145,49 +149,24 @@ function _pathologic_filter($text, $filter, $format, $langcode, $cache, $cache_i
       $local_paths = array_filter(array_map('trim', explode("\n", $filter_settings['local_paths'])));
       foreach ($local_paths as $local) {
         $parts = @parse_url($local);
-        // Okay, what the hellish "if" statement is doing below is checking to
-        // make sure we aren't about to add a path to our array of exploded
-        // local paths which matches the current "local" path. We consider it
-        // not a match, if…
-        // @todo: This is pretty horrible. Can this be simplified?
-        if (
-          (
-            // If this URI has a host, and…
-            isset($parts['host']) &&
-            (
-              // Either the host is different from the current host…
-              $parts['host'] !== $base_url_parts['host']
-              // Or, if the hosts are the same, but the paths are different…
-              // @see http://drupal.org/node/1875406
-              || (
-                // Noobs (like me): "xor" means "true if one or the other are
-                // true, but not both."
-                (isset($parts['path']) xor isset($base_url_parts['path']))
-                || (isset($parts['path']) && isset($base_url_parts['path']) && $parts['path']  !== $base_url_parts['path'])
-              )
-            )
-          ) ||
-          // Or…
-          (
-            // The URI doesn't have a host…
-            !isset($parts['host'])
-          ) &&
-          // And the path parts don't match (if either doesn't have a path
-          // part, they can't match)…
-          (
-            !isset($parts['path']) ||
-            !isset($base_url_parts['path']) ||
-            $parts['path'] !== $base_url_parts['path']
-          )
-        ) {
-          // Add it to the list.
-          $filter_settings['local_paths_exploded'][] = $parts;
+        // Add it to the list.
+        $filter->settings['local_paths_exploded'][] = $parts;
+        if ($parts == $currentPath) {
+          $currentPathAdded = TRUE;
+        }
+        if ($parts == $currentHostPath) {
+          $currentHostPathAdded = TRUE;
         }
       }
     }
-    // Now add local paths based on "this" server URL.
-    $filter_settings['local_paths_exploded'][] = array('path' => $base_url_parts['path']);
-    $filter_settings['local_paths_exploded'][] = array('path' => $base_url_parts['path'], 'host' => $base_url_parts['host']);
+    // Now add local paths based on "this" server URL, but only if not already
+    // done so.
+    if (!$currentPathAdded) {
+      $filter->settings['local_paths_exploded'][] = $currentPath;
+    }
+    if (!$currentHostPathAdded) {
+      $filter->settings['local_paths_exploded'][] = $currentHostPath;
+    }
     // We'll also just store the host part separately for easy access.
     $filter_settings['base_url_host'] = $base_url_parts['host'];
 
