Conditional patterns with automatic nodetitles
That module also provides the ability to use PHP to construct the pattern.  Look for the check box at the bottom.



Please refer to the module's help file for more info on combining PHP and tokens for the pattern.