Lattice dynamics and dielectric response of Mg-doped SrTiO3 ceramics in a wide frequency range