Testing and refactoring

* Added unit tests for the index.php
* Refactored index.php
** Moved logging to own function in order to handle log-file-not-found -case better (doesn't tell the requester it)
** Few print_r -> echo changes