Fixed prettifying for older php versions

I changed some of the part of the dialog used for displaying the report and created a function to handle the prettifying if json_encode cannot be used.