Prevent crashes due to regexp compilation errors

Page titles are now properly escaped using preg_quote() to prevent regexp
compilation errors if the title contains characters with special meanings in
regular expressions.