Sort by date (assigning date to some of the undated logs).