Miscellaneous changes

* Removes closing tags of PHP blocks at the end of files, which are not needed and sometimes introduce issues when serving binary content: http://php.net/manual/en/language.basic-syntax.instruction-separation.php
* Remove some calls to `isset()` as [`empty()`](http://www.php.net/manual/en/function.empty.php) does this existence check as well.
* Update `.gitignore` to ignore the `htdocs/xml/` directory.
* Add a check to `htdocs/index.php` that `$titles` is not empty (which can happen if there is no data in the database).