A paper states:
[...] $(p,g,y)$ is a correct ElGamal public key if $g^x=y\pmod p$. To verify this the order of $g$, and thus the factorization of $p-1$, is needed. This is easy for safe primes (i.e., primes $p$ for which $\frac{p-1}2$ is prime), but may be hard otherwise [...]
Why is it easy to factorize a safe prime's predecessor?