Here's a way to limit rotation, past a certain degree from starting position, on two axis, using quaternions.