The Ukrainian government couldn't be at war in Donbas illegally, it was restoring Ukraine's international borders within its territory. Who were illegally there is Russian troops and mercenaries.
According to the UN, the overall deaths toll of the Donbas war is around 14 500 people. The vast majority of the deaths happened in 2014-15 when the active phase of the war was going. Out of the overall number, roughly 4 500 was the losses of the Ukrainian armed forces, 6 500 was the separatists' armed forces, 3 500 is civilians. In five years (2016-2021) the death toll among civilians was 365 people.