What are the measures to take to ensure the safety of the person who is spotting a climber?
This is not a complete list per se.
If bouldering outdoors, particularly with an overhang, wear a helmet. This isn't to protect you from a fall, it's to protect your head for if rocks get knocked down onto you.
When spotting, maintain an athletic stance. If you just stand normally, you won't be able to absorb impact from a fall as well.
"Spoons, not forks" for your hands. When spotting, keep your fingers together, not spread out. Individual fingers sticking out are more likely to get caught on something or twisted weirdly.
If the climber falls, do not try to catch them. Guide them gently to the ground, ensuring they don't hit their head on anything. The purpose of a spotter is not to break a fall (which is likely to hurt both the climber and the spotter), it is to guide the fall to ensure the climber doesn't hit something dangerous on their way down.
Be mindful of what's around you. Clear large debris if possible, like branches or movable rocks. If you get knocked down, you don't want to hit something and get injured.
I like to wear some kind of sunglasses or even cheapo safety glasses if it's not sunny. Dirt and small rocks often gets knocked off the rock, which is very annoying to get in your eyes.
You have one principle risk of injury as a spotter, and that is from a climber falling on top of you or hitting you.
As a spotter, your job is simply to direct falls to the crash pad. You are not there to actually catch the person, you are not there to be a crashpad, you are there to ensure that the pad stays under the climber, and that the climber lands safely on the pad. If you are standing underneath the climber, or standing on top of the crashpad, then you are potentially putting yourself at risk.
When you spot, keep your hands up and behind the climbers centre of mass, this is above the waist in men, lower on women. Be alert when the climber is working through their beta, and be prepared for a fall during difficult or dynamic moves. If the problem they're on traverses a boulder, you may need to move the pad(s) to keep them under the climber at all times. It's important to do this while they're going through an easier section of the problem or resting on a hold, and not right when they're about to attempt a difficult move when they really need a spot. It's good to have more than one spotter for problems like this, one to move the pad, and the others to spot the climber. When the climber falls, don't try to stop their fall, just put your hands on them and catch the fall by helping them land on their feet/butt first and directing them to the middle of the pad. You are there to direct their fall to the pad, and help them avoid injury. If a climber falls head first, do not try to catch their head! Get your hands on their back and direct their feet to the pad.
Use your legs! When going down with the climber, go all the way down with them, get your hands behind their centre of mass and bend at the knees as you bring them down towards the mat. Even though you're not catching their full weight, taking a person to the chest can be jarring, and you can hurt your self or your back if you catch their fall wrong.
Mind your surroundings! just because the climber is safe if they fall doesn't mean you will be. There are situations where a climber can swing out and knock you in the head or knock you into another rock/tree/person/off a cliff/whatever, make sure wherever you stand, you aren't going to get hit or hurt if the climber falls.
One other thing you could do is make sure that your climbing partner doesn't try doing something stupid, like highballing some crumby climb without proper protection. I was out scrambling with a friend one time who wanted to impress his girlfriend by climbing up to a window he spotted up on a cliff face. I started to follow, but decided eight feet up that it would be too sketchy to down climb, so I waited at the bottom. On his way down my friend got ledged out and couldn't find any more feet holds despite me shouting some out to him. He eventually got pumped out and lost his grip on the rock. I had no choice but to full on try to catch him or else he was going to do damage to himself and tumble all the way down the big scree slope below us, likely ending up a big smear on a rock. I caught him around the middle, and dug me feet in to prevent him from taking us both down the mountain, we both got hurt to some degree, but I absorbed some of his fall and prevented us both from going down the slope.