How legal is it when providing references to confirm dates, sickness and disciplinary ONLY? What about pending dangers for indirect discrimination due to references received?

For example, an employee of ours had 59 days of sickness/5 episodes but her performance was way beyond the average and, another employee had 3 days of sickness/1 episode but performance has been poor. Also, another had a disciplinary action against him but in total is a very good employee and others who had no disciplinary action have been performing just ok. How accurate such a reference can it be?

Is it legal to have a dual reference policy where one can give the accurate image for employers who performed well regardless of their sickness/disciplinary record and, just to  confirm dates of employment/sickness/disciplinary record for those who didn’t perform well?

I would appreciate your help on this one!