Replace log  for $log and set as errors
th tags should be td tags inside tfoot