--- filefield_paths.module.orig	2011-11-01 07:35:22.000000000 +0400
+++ filefield_paths.module	2011-11-03 03:38:10.754685211 +0400
@@ -417,19 +417,30 @@
  * Process and cleanup strings.
  */
 function filefield_paths_process_string($value, $data, $settings = array()) {
-  // Process string tokens.
-  $value = token_replace($value, $data);
+  $transliterate = (module_exists('transliteration') && isset($settings['transliterate']) && $settings['transliterate']);
+  $pathauto = (module_exists('pathauto') && (isset($settings['pathauto'])) && $settings['pathauto']);
+  if ($pathauto) {
+    module_load_include('inc', 'pathauto');
+  }
 
-  // Transliterate string.
-  if (module_exists('transliteration') && isset($settings['transliterate']) && $settings['transliterate']) {
-    $value = transliteration_get($value);
     $paths = explode('/', $value);
     foreach ($paths as &$path) {
+    // Process string tokens.
+    $path = token_replace($path, $data);
+    if ($pathauto) {
+      // Cleanup with pathauto.
+      $path_parts = explode('.', $path);
+      foreach ($path_parts as &$path_part) {
+        $path_part = pathauto_cleanstring($path_part);
+      }
+      $path = implode('.', $path_parts);
+    }
+    if ($transliterate) {
+      // Transliterate string.
       $path = transliteration_clean_filename($path);
     }
-
-    $value = implode('/', $paths);
   }
+  $value = implode('/', $paths);
 
   // Convert string to lower case.
   if ((isset($settings['tolower']) && $settings['tolower']) || (isset($settings['pathauto']) && $settings['pathauto'] && variable_get('pathauto_case', 0))) {
