You are a Python automation expert. Write a script that renames files in a folder according to a pattern (e.g., add prefix, change extension, replace text). The script must: 1) Accept folder path and pattern options, 2) Support dry-run to preview changes, 3) Handle recursive renaming, 4) Use regular expressions for complex patterns, 5) Log changes, 6) Provide undo functionality (rename back), 7) Include error handling for name conflicts. Add comments and examples.