Index: pathauto.inc
===================================================================
RCS file: /cvs/drupal/contributions/modules/pathauto/pathauto.inc,v
retrieving revision 1.1.2.51
diff -u -r1.1.2.51 pathauto.inc
--- pathauto.inc	18 Jun 2008 20:05:08 -0000	1.1.2.51
+++ pathauto.inc	21 Jul 2009 14:31:40 -0000
@@ -197,13 +197,18 @@
     else {
       $seppattern = '\\'. $separator;
     }
-    // Trim any leading or trailing separators (note the need to
+    // Trim any leading or trailing separators
     $output = preg_replace("/^$seppattern+|$seppattern+$/", '', $output);
 
     // Replace multiple separators with a single one
     $output = preg_replace("/$seppattern+/", "$separator", $output);
   }
 
+  // Optionally convert to lower case
+  if (variable_get('pathauto_case', PATHAUTO_CASE_LOWER)) {
+    $output = drupal_strtolower($output);
+  }
+
   // Enforce the maximum component length
   $maxlength = min(variable_get('pathauto_max_component_length', 100), 128);
   $output = drupal_substr($output, 0, $maxlength);
@@ -277,14 +282,9 @@
     $old_alias = $update_data['old_alias'];
   }
 
-  // Replace the placeholders with the values provided by the module,
-  // and optionally lower-case the result
+  // Replace the placeholders with the values provided by the module
   $alias = str_replace($placeholders['tokens'], $placeholders['values'], $pattern);
 
-  if (variable_get('pathauto_case', 1)) {
-    $alias = drupal_strtolower($alias);
-  }
-
   // Two or more slashes should be collapsed into one
   $alias = preg_replace('/\/+/', '/', $alias);
 