Hi, Sue and other EE staff,
The original intent of these codes was to make sure that the url follows a certain format and ONLY those URLs will yield a non-error page. The intended format was the following:
segment 1 = is this a weblog or image gallery?
segment 2 = if weblog, which subsection? if image, which subgallery?
segment 3 = only a number (no non-numerics, except for pagination or category)**, identifying the entry ID or image ID or category ID
Many of the complex conditional is to help to determine the appropriate title for the page that depends on these segments.
**The segments also make provisions that segment 3 may begin with either a C (for category) or P (for page) so that in some cases these non-numerics are also valid. This explains why I am using substr and ctype_digit in PHP to test specific characteristics of the URL segments.
Somehow using these added PHP functions with the built-in EE segment variables is creating a problem with the interpretation of backslash (in Firefox, which unlike Opera or IE, does not convert to a forward slash) causing EE to report a PHP error.