Index: pathauto.admin.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto.admin.inc,v retrieving revision 1.20 diff -u -p -r1.20 pathauto.admin.inc --- pathauto.admin.inc 13 Sep 2008 08:54:06 -0000 1.20 +++ pathauto.admin.inc 3 Jul 2009 23:31:02 -0000 @@ -73,7 +73,7 @@ function pathauto_admin_settings() { '#size' => 3, '#maxlength' => 3, '#default_value' => variable_get('pathauto_max_length', 100), - '#description' => t('Maximum length of aliases to generate. 100 is recommended. See Pathauto help for details.', array('@pathauto-help' => url('admin/help/pathauto'))), + '#description' => t('Maximum length of aliases to generate. 100 is recommended. The maximum possible length is @max. See Pathauto help for details.', array('@pathauto-help' => url('admin/help/pathauto'), '@max' => _pathauto_get_schema_alias_maxlength())), ); $form['general']['pathauto_max_component_length'] = array( Index: pathauto.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/pathauto/pathauto.inc,v retrieving revision 1.51 diff -u -p -r1.51 pathauto.inc --- pathauto.inc 21 Mar 2009 00:24:28 -0000 1.51 +++ pathauto.inc 3 Jul 2009 23:31:09 -0000 @@ -344,7 +344,7 @@ function pathauto_create_alias($module, // Shorten to a logical place based on the last separator. $separator = variable_get('pathauto_separator', '-'); - $maxlength = min(variable_get('pathauto_max_length', 100), 128); + $maxlength = min(variable_get('pathauto_max_length', 100), _pathauto_get_schema_alias_maxlength()); // Make sure we're not ending the alias in the middle of a word. $alias = _pathauto_truncate_chars($alias, $maxlength, $separator); @@ -388,6 +388,17 @@ function pathauto_create_alias($module, } /** + * Fetch the maximum length of the {url_alias}.dst field from the schema. + * + * @return + * An integer of the maximum url alias length allowed by the database. + */ +function _pathauto_get_schema_alias_maxlength() { + $schema = drupal_get_schema('url_alias'); + return $schema['fields']['dst']['length']; +} + +/** * Verify if the given path is a valid menu callback. * * Taken from menu_execute_active_handler().