Site Map mysql error

Permalink
Site Map isn't working, error below. Checked and repaired various Collection tables, and checked the page_list.php file for obvious corruption, though I'm not a php programmer and new to c5.

Configuration environment posted at bottom.

Any advice would be appreciated!

Here's the error: -------

An unexpected error occurred.

mysql error: [1064: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'JOIN p1.cID JOIN p2.cID)) left join CollectionSearchIndexAttributes on (Collec' at line 1] in EXECUTE("select p1.cID, pt.ctHandle from Pages p1 left join Pages p2 on (p1.cPointerID = p2.cID) left join PageTypes pt on (pt.ctID = (if (p2.cID is null, p1.ctID, p2.cID))) left join PagePaths on (PagePaths.cID = p1.cID and PagePaths.ppIsCanonical = 1) left join PageSearchIndex psi on (psi.cID = if(p2.cID is null, p1.cID, p2.cID)) inner join CollectionVersions cv on (cv.cID = if(p2.cID is null, p1.cID, p2.cID) and cvID = (select max(cvID) from CollectionVersions where cID = cv.cID)) inner join Collections c on (c.cID = if(p2.cID is null, p1.cID, p2.cID)) left join CollectionSearchIndexAttributes on (CollectionSearchIndexAttributes.cID = if (p2.cID is null, p1.cID, p2.cID)) where 1=1 and p1.cParentID = '0' and (p1.cIsTemplate = 0 or p2.cIsTemplate = 0) and (p1.cID not in ( .... [long list of numbers snipped]


Environment: -------
# concrete5 Version 5.4.0.5
# concrete5 Packages None
# concrete5 Overrides themes/earthtones_moss
# Server Software Apache
# Server API cgi
# PHP Version 5.2.2
# PHP Extensions
cgi, ctype, curl, date, dbase, dom, exif, filter, ftp, gd, hash, iconv, ionCube Loader, json, libxml, mbstring, mcrypt, mysql, mysqli, openssl, pcre, PDO, pdo_mysql, pdo_sqlite, posix, Reflection, session, SimpleXML, SPL, SQLite, standard, tokenizer, xml, xmlreader, xmlwriter, zlib.

# PHP Settings
log_errors_max_len - 1024
max_execution_time - 30
max_input_nesting_level - 64
max_input_time - -1
memory_limit - 128M
post_max_size - 8M
safe_mode - Off
safe_mode_exec_dir - /usr/local/php/bin
safe_mode_gid - Off
safe_mode_include_dir - <i>no value</i>
sql.safe_mode - Off
upload_max_filesize - 20000000
mysql.max_links - Unlimited
mysql.max_persistent - Unlimited
mysqli.max_links - Unlimited
session.cache_limiter - nocache
session.gc_maxlifetime - 7200
safe_mode_allowed_env_vars - PHP_
safe_mode_protected_env_vars - LD_LIBRARY_PATH

wreford