Nice thinking!
I did the checks:
database.php ->127.0.0.1
The VM is a regular Ubuntu 14.04 Lamp stack
When the system only returns 2 courses, template.php takes only 268 ms (milisecond)
Which means that it is the shear number of results, 181 LO's
Is it possible to run into some query time limit?
Edit [12-10-2016 15:55]
I turned on the logging feature in xerte and this is what it does (I firewalled off other users, Im the only one):
2016-10-12 15:48:30 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:30 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:30 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:30 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:30 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:30 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:30 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:30 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:30 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:30 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:30 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:31 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:31 /var/www/html/moodle/xerte/website_code/php/display_library.php461Running : select td.template_name as project_name, otd.template_name, otd.template_framework, td.template_id, tr.role from xer_templatedetails td, xer_templaterights tr, xer_originaltemplatesdetails otd where td.template_id = tr.template_id and tr.user_id = ? and tr.folder= ? and otd.template_type_id = td.template_type_id order by td.date_created DESC
2016-10-12 15:48:31 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:31 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:31 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:32 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:32 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:32 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:32 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:32 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:32 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:32 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:32 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:32 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:32 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:32 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:32 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:32 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:32 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:32 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:32 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:33 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:33 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:33 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:33 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:33 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:33 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:33 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:33 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:33 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:33 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:33 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:33 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:33 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:33 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:34 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?
2016-10-12 15:48:34 /var/www/html/moodle/xerte/website_code/php/database_library.php175Running : select * from xer_templaterights tr, xer_folderdetails fd where tr.role='creator' and tr.folder=fd.folder_id and tr.template_id=?