Fix Events > History (none) gives Internal Server Error caused by NPE

This PR contains a fix for a NPE found in Events > History whenever a package action was "scheduled by (none)" which could be e.g. package installations initiated from a bootstrap script.

Further a possible script injection has been fixed: whenever a package name contains a script (not sure though if actually a script can somehow slip into the database as a package name) it is now going to be escaped before it is listed here.