Manual:CleanupTitles.php

cleanupTitles.php is a maint-scripts>Special:MyLanguage/Manual:Maintenance scripts|maintenance script located in the maintenance directory that can be used to clean up broken, unparseable titles. The edits will be attributed to the user called Conversion script. This script is rather useful for cases in which someone has added a new interwiki prefix (e.g. ) to the iwtable>Special:MyLanguage/Manual:Interwiki table|interwiki table and thereby caused mainspace pages with ambiguous titles (e.g. Commandos: Behind Enemy Lines) to become inaccessible. Likewise, the script can be used to process changes in titlechars>Special:MyLanguage/Manual:$wgLegalTitleChars|$wgLegalTitleChars that rendered previously valid page titles inaccesible.

Usage
php cleanupTitles.php

For additional options see php cleanupTitles.php --help

Result
Fixed pages are moved to Broken/ (where is the cleaned up version of the broken title)