replace
$site_template->register_vars( 'cat_wordsearch', (empty($search_cat_result) ? "" join("\n\n<li>", $search_cat_result)) ); // add result to template
with:
$site_template->register_vars( 'cat_wordsearch', (empty($search_cat_result) ? "" : join("\n\n<li>", $search_cat_result)) ); // add result to template
P.S. next time please format your post with bbcodes and if you are planning on showing code from the entire file, consider attach it to your post as an attachment (this time I did it for you), this way it won't clog up the database with unnecessary data.