Index: trunk/kernel/include/item.php =================================================================== diff -u -r3261 -r3268 --- trunk/kernel/include/item.php (.../item.php) (revision 3261) +++ trunk/kernel/include/item.php (.../item.php) (revision 3268) @@ -1131,14 +1131,14 @@ $found_item_ids = $db->GetCol($sql); $has_page = preg_match('/(.*)_([\d]+)([a-z]*)$/', $filename, $rets); - $duplicates_found = (count($found_item_ids) > 1); + $duplicates_found = (count($found_item_ids) > 1) || ($found_item_ids && $found_item_ids[0] != $this->UniqueId()); if ($duplicates_found || $has_page) // other category has same filename as ours OR we have filename, that ends with _number { - $append = $duplicates_found ? 'a' : ''; + $append = $duplicates_found ? '_a' : ''; if($has_page) { $filename = $rets[1].'_'.$rets[2]; - $append = $rets[3] ? $rets[3] : 'a'; + $append = $rets[3] ? $rets[3] : '_a'; } $sql = 'SELECT '.$this->IdField().' FROM '.$this->tablename.' WHERE (Filename = %s) AND ('.$this->IdField().' != '.$this->UniqueId().')';