Features of Pinning of a Charge-Density Wave in Quasi-Two-Dimensional Compounds