Index: cdn.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/cdn/cdn.module,v
retrieving revision 1.33
diff -u -r1.33 cdn.module
--- cdn.module	4 Feb 2010 00:30:34 -0000	1.33
+++ cdn.module	3 Apr 2010 02:23:37 -0000
@@ -52,6 +52,27 @@
   $stats      = variable_get(CDN_STATS_VARIABLE, FALSE) && user_access(CDN_PERM_ACCESS_STATS);
   $exclusions = variable_get(CDN_EXCLUSION_VARIABLE, CDN_EXCLUSION_DEFAULT);
 
+  // If pathologic is enabled, use its settings to perform similar processing on the path
+  if (module_exists('pathologic')) {
+
+    // Retrieve matching paths settings
+    $paths = array();
+    $directive = trim(variable_get("filter_pathologic_abs_paths_1", '')); // using Filtered HTML format
+    if ($directive !== '') {
+      $paths = array_map('trim', explode("\n", $directive)); // get rid of white space on each line
+    }
+    $paths[] = _pathologic_url('<front>');
+    $paths = array_unique($paths);
+
+    // Build regexp, match twice (with or without leading slash) and then trim slashes
+    $path_suffix =  '/?(index.php)?(\?q=)?'; // the optional suffix to match
+    $path_regexp = '(' . implode($path_suffix.'|',$paths) . $path_suffix . ')';
+    $original_path = $path;  
+    $path = preg_replace($path_regexp, '', $path);
+    $path = preg_replace($path_regexp, '', '/'.$path);
+    $path = '/'.trim($path, '\\/'); 
+  }
+  
   // If the current path is an absolute path, return immediately.
   $fragments = parse_url($path);
   if (isset($fragments['host']))

