Optical variability of quasars: Statistics and cosmological properties