Check that $_SERVER['SERVER_NAME'] is exists before use
Check that $_SERVER['SERVER_NAME'] is exists before use correctly.
Remove use of AS keyword from sql query in tag api.

In general, in the mantis code base, we do not add 'as' for tables,
and some database engines do not support AS in this context.