Moved ORDER BY clause, added troubleshooting function
Created complete API for logs

Todo:
-Move the frontend to the API
-Move rendering log data to the frontend
-Remove lib/logs, the old logs class, and displaylogs class